Forum Replies Created

Viewing 27 posts - 211 through 237 (of 237 total)
  • Author
    Posts
  • in reply to: Custom sidebars for post types #418886

    The first link helped quite a bit. Thanks!

    in reply to: Display different menu to mobile users #412586

    Thanks. I realized that was the solution right after I posted my response. :-)

    Thanks!

    in reply to: Display different menu to mobile users #412578

    Hey, Josue. I want to do the opposite. I want some things to ONLY show up in the mobile menu. Any suggestions?

    Thanks!
    kcm

    in reply to: Unable to re-arrange photos in page gallery #410239

    By the way, this also seemed to solve an issue where I couldn’t expand the accordion on the side of Appearance > Menus.

    in reply to: Unable to re-arrange photos in page gallery #410197

    That fixed the issue. Can you explain what that does in this case? Will it impact the performance of the site?

    Thanks!

    in reply to: Unable to re-arrange photos in page gallery #410076

    I think you might have misunderstood the issue. The sorting feature works in Firefox but doesn’t work in Chrome. Both browsers are totally up to date. Firefox is running a couple addons but it works in Firefox so apparently that doesn’t matter for that browser. Chrome does NOT have any add ons loaded and I’m NOT able to sort the images by dragging them.

    Does that make sense?

    in reply to: Increase thickness of line under nav items #403046

    I have no idea how I missed that. Sorry to bug you but thanks for your help. :-)

    I definitely get that approach but it won’t carry through onto all pages like Category pages, for example. It sounds like what I’m asking for doesn’t exist though, right?

    This probably boils down into a feature request but I really wish Enfold had hooks before and after each of the opening and closing tags for major layout areas so we could inject into the design without having to modify the template files themselves.

    This reply has been marked as private.
    in reply to: Link to specific accordion section #397244

    Never mind. I figured this out. For some reason it wasn’t working earlier but now it is.

    Thanks!

    in reply to: Change resolution where mobile menu shows? #394765

    Okay, I see what you did there. Thanks!

    This reply has been marked as private.
    in reply to: Different logo when header shrinks? #386606

    The scrolled logo does not show when it uses the // method. It only works if I disable that line of code in class-style-generator.php.

    I’m experiencing the same issues setting up a new site from scratch. In general it seems that the window background settings are working incorrectly. The site ignores background color settings or settings to use provided background images but when I put in a full screen static background image, the backgrounds of the title/breadcrumb area and the content area go transparent.

    in reply to: Different logo when header shrinks? #385198

    [deleted]

    in reply to: Different logo when header shrinks? #385196

    Actually after a little more searching, I figured out what’s causing this. For some reason the avia_style_generator class strips http and https out of the rules in class-style-generator.php:

    $rule['value'] = preg_replace('/(http|https):\/\//', '//', $rule['value']);

    Any idea why it does this or how to work around it?

    Thanks!

    in reply to: Different logo when header shrinks? #385192

    Thanks for your reply, Josue. That post was very helpful. I decided to add the scroll logo as a theme option and everything is going very well but I’ve run into one problem. Hopefully you can help.

    I added the following to create a theme option field for the scroll logo:

    add_filter('avf_option_page_data_init', 'pwm_utilities_avf_option_page_data_init', 10, 1);
    function pwm_utilities_avf_option_page_data_init($avia_elements){
    	
    $new_elements[] =	array(
    					"slug"	=> "avia",
    					"name" 	=> __("Scroll Logo", 'avia_framework'),
    					"desc" 	=> __("Upload a logo image, or enter the URL or ID of an image if its already uploaded. This logo is optionally displayed when the user scrolls down the page.", 'avia_framework'),
    					"id" 	=> "scroll_logo",
    					"type" 	=> "upload",
    					"label"	=> __("Use Image as scoll logo", 'avia_framework'));
    
    	$avia_elements = array_merge( $avia_elements, $new_elements );
    
      return $avia_elements;
    }

    And leveraged one of the built in filters to add the CSS for the scroll logo to the dynamic CSS:

    add_filter('avia_dynamic_css_output', 'pwm_avia_dynamic_css_output', 10, 2 );
    function pwm_avia_dynamic_css_output( $output, $color_set ){
    	
    	$scroll_logo = avia_get_option('scroll_logo');
    	if($scroll_logo) :
    		$output .= "header-scrolled .logo img { opacity: 0; }.header-scrolled .logo a { background-image: url($scroll_logo);background-size: contain; background-repeat: no-repeat; }";
    	endif;
    	return $output;
    }

    This all works really well except at some point after my pwm_avia_dynamic_css_output is run, the “http:” gets stripped off the URL for the background image. I can’t figure out where this is happening or why. Can you point me in the right direction?

    Thanks!

    in reply to: How are testimonials saved? #384161

    Sure thing! I love Enfold. :-)

    in reply to: Sidebar settings for custom post types and CPT archives #383922

    Okay. I’ll put this in as a feature request.

    Thanks!

    in reply to: I don't receive notifications of replies to my posts #383491

    Thanks!

    in reply to: How are testimonials saved? #383399

    Happy to help. Definitely let me know how it goes. :-)

    in reply to: How are testimonials saved? #383346

    Okay, good morning! First, I’m going to assume that you have created your custom post type via a plugin. If not, you should consider doing so because you will be able to reuse this code on any Enfold-based site. The following assumes that your CPT is called “testimonials” and the taxonomy is called “testcat”. They can be something else; you’d just have to modify the code below accordingly. This also assumes that the CPT has a variety of meta fields to contain the information about the testimonial. Such as company, URL and link text. If you don’t know how to do any of the items above, let me know.

    Before you get started, create 2-3 testimonials posts with your new CPT plugin and assign them to a category. Better yet, create 2-3 in two different categories so you can be sure that the correct ones are being displayed when you view the testimonials on the front end of the site later on.

    All of the builder elements are stored in a folder inside Enfold. Look in the themes folder and find enfold > config-templatebuilder > avia-shortcodes. DO NOT modify any of these files since that will cause problems with upgrading Enfold later. Instead, uses the items here as a place to start when you want to override a shortcode/builder element.

    Inside your plugin folder, create a subfolder called “avia-shortcodes”. It could really be called anything but I like to name it the same as what the theme uses. This is where you’re custom builder element(s) will live. You can put as many builder elements there as you wish and they will all get loaded into the builder at the same time. So, if you want to make one builder element that shows all testimonials from a specific category and another that loads one random testimonial you can do that by putting the correct code in this directory. For this example, we’ll just make the one builder element.

    Copy testimonials.php from the enfold directory into the shortcode directory you just created in your plugin.

    In your plugin code, add the following. This will tell enfold to load any shortcodes from your avia-shortcodes directory within the plugin folder. Notice that the function name contains the word “testimonials”. As you get more proficient at this you might be loading shortcodes for multiple plugins from multiple locations.

    // register builder shortcodes
    add_filter('avia_load_shortcodes', 'pwm_include_shortcode_template_testimonials', 15, 1);
    function pwm_include_shortcode_template_testimonials( $paths ){
    	array_unshift($paths, dirname( __FILE__ ) . '/avia-shortcodes/');
    	return $paths;
    }

    If you upload your plugin and activate it now, enfold will start using your new testimonials.php immediately. Since the testimonials.php file is wrapped in a “class_exists( ‘avia_sc_testimonial’ )” condition, enfold will load your testimonials.php file and when it goes to load it’s own there will already be an existing class with the same name so it will not load the enfold testimonials.php.

    At this point, you’ve effectively hijacked the testimonials builder block and you can do whatever you want with it. Everything below will be done in your NEW testimonials.php file and I won’t refer to the old one again. The issue is that it’s not obvious in the backend that the builder is using your NEW block. So, find the following line of code in your NEW testimonials.php file:

    $this->config['name'] = __('Testimonials', 'avia_framework' );

    and change it to something like:

    $this->config['name'] = __('CPT Testimonials', 'avia_framework' );

    If you load the builder in the backend of WordPress, you should see the new name for the builder block in the toolbar. The new testimonials.php still works exactly like the one built into enfold, though, and doesn’t pull from your CPT yet. There are two things to deal with: (1) allow the user to choose a category of testimonials to display while they’re building the page in the builder and (2) display those testimonials on the front end when the page is displayed. So, let’s hand the first issue:

    Altering the builder user interface

    Find the line in your testimonials.php file that says:

    function popup_elements()

    This function handles all of the elements in the builder popup windows for this element. Each of the shortcode files has a function like this and is where you would go to modify the info the user has to enter for a given builder element. At the top of this function, we need to get the list of testimonial categories that the user will choose from to display. Add the following right after the function declaration and indent it accordingly

    // get a list of available terms in the taxonomy_exists
    $terms = get_terms("testcat");
    $testimonial_categories[ 'Select One' ] = null;
    if ( !empty( $terms ) && !is_wp_error( $terms ) ):
    	// compile an array for display below
    	foreach ( $terms as $term ) :
    		$testimonial_categories[$term->name] = $term->slug;
    	endforeach;
    endif;

    Now we have an array of the available categories and we can display them in a dropdown SELECT box to the user. But currently the builder has the code that let’s you build testimonials one-by-one in a second popup window and that has to be removed. If you look a little farther down in the popup_elements() you’ll see a bunch of nested arrays that represent all the items that will get displayed to the user. Find the one that starts:

    array(
    	"name" => __("Add/Edit Testimonial", 'avia_framework' ),

    This entire array including it’s “subelements” array has to be deleted. Stop deleting just before you see the next array:

    array(
    	"name" 	=> __("Testimonial Style", 'avia_framework' ),

    In place of what you just deleted, put the following code. This will create the dropdown menu of available testimonial categories:

    array(
    	"name" 	=> __("Testimonial Category", 'avia_framework' ),
    	"desc" 	=> "The category of testimonials being displayed here",
    	"id" 	=> "testcat",
    	"type" 	=> "select",
    	"std" 	=> "",
    	"subtype" => $testimonial_categories
    ),

    Also, scroll down a little farther and delete the entire function that starts with:

    function editor_sub_element($params)

    You can delete the preceding comments too if you want to keep your code clean.

    Save your testimonials.php file and upload it to the server. Then go into a page and view the page builder (refresh if you were already looking at it). Insert the CPT Testimonials block and you should now see that you have the ability to select a testimonial category rather than entering them one-by-one. If you try to view the page on the front end, though, it will probably break or display a blank area.

    Leveraging your custom post type

    Now we have to tell testimonials.php to pull from your CPT when displaying on the front end. For simplicity, we’re just going to hijack the way the shortcodes already work. Immediately after the function you just deleted, you should find this one:

    function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")

    We have to make the shortcode aware of the new “testcat” parameter so find the shortcode_atts array and add

    'testcat'=> "",

    as the first line right above ‘style’=>”grid”. Now, scroll down inside this function until you find the following line:

    if($style != "grid") avia_sc_testimonial::$columns = 100000;

    Immediately after that line, place the following block of code. Be careful not to replace anything.

    // wp_reset_postdata() doesn't want to work for some reason so let's work around it
    global $post;
    $temp = $post;
    
    // get a list testimonials for this category
    // The Query
    $args = array(
    	'post_type' => 'testimonials',
    	'orderby' => 'menu_order',
    	'order' => 'asc',
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'testcat',
    			'field'    => 'slug',
    			'terms'    => $testcat,
    		),
    	),
    );
    $the_query = new WP_Query( $args );
    
    // The Loop
    if ( $the_query->have_posts() ) :
    	while ( $the_query->have_posts() ) :
    		$the_query->the_post();
    		
    		// get the post meta data
    		$testimonial_content = get_the_content();
    		$custom = get_post_custom( $post_id );
    		
    		$src = get_post_thumbnail_id( get_the_id());
    		$name = $custom[ 'pwm_testimonial_alt_name' ][ 0 ] ? $custom[ 'pwm_testimonial_alt_name' ][ 0 ] : get_the_title();
    		$subtitle = $custom[ 'pwm_testimonial_company' ][ 0 ];
    		$link = $custom[ 'pwm_testimonial_url' ][ 0 ];
    		$linktext = $custom[ 'pwm_testimonial_link_text' ][ 0 ];
    
    		// add a shortcode for the currernt testimonial
    		$content .= "[av_testimonial_single src=\"$src\" name=\"$name\" subtitle=\"$subtitle\" link=\"$link\" linktext=\"$linktext\"]" . $testimonial_content . "[/av_testimonial_single]";
    	endwhile;
    else:
    	// no posts found
    endif;
    /* Restore original Post Data */
    wp_reset_postdata();
    
    /* Restore original Post Data */
    $post = $temp;

    This code loops through the testimonials in the selected category and sets up the av_testimonial_single shortcode to display your CPT data instead of data entered via the builder. One thing to notice is that on the 31st thru 34th lines of this new block of code, it refers to the metadata fields that contain the company, URL, etc for the testimonial. You should replace these names with whatever you used when you set up your metadata in the plugin.

    Hopefully, if you save your work and upload it, the new builder block will now display your testimonials from your Custom Post Type. There’s a small chance I may have left out some important detail and if it doesn’t work, you should feel free to ask me to look over your work.

    I hope this helps. Let me know how things turn out either way, okay? Good luck!

    in reply to: How are testimonials saved? #382916

    Hi Sharon. It’s almost midnight here. If I have time in the morning I’m give you a rundown on how to do it. It’s not rocket science but there are some steps involved. Stay tuned. :-)

    in reply to: How are testimonials saved? #382900

    Hi Sharon. You can’t do this without modifying the built in enfold testimonial functionality. By default the testimonials are stored within the metadata of the page they are created on and it’s not practical to reuse them once they have been entered.

    I’ve done what you’re asking by making an alternate builder element for testimonials (based on enfold’s) and telling WP/enfold to use mine instead. It pulls from a custom post type using a taxonomy term. I have testimonial posts assigned to categories like “front page” and my testimonial builder element allows the user to choose a category along with all the other normal testimonial options instead of entering individual testimonials. Then when my builder element is displayed it fetches the relevant testimonial posts and uses the built in shortcodes to display them.

    Does that make sense?

    If you’re comfortable with coding plugins and understand filters/actions you could do this as well. If you’re not it would be quite a challenge to do it. Let me know how experienced/comfortable you are with coding.

    in reply to: EasySlider: Play X number of times? #382717

    Thanks, Elliott. No worries!

    in reply to: Disable Appearance > Install Plugins #366703

    Hey, Ismael. I feel like maybe I’m not asking my question well and that’s why I’m not getting a definitive “yes or no” answer to my questions. I understand how to edit the various admin menu but that doesn’t address my issue.

    1) Can I disable (that is, cause the code not to run) the code that adds the Install Plugins option under the Appearances menu? I’m not looking to simply remove the item from the menu after the fact.

    2) If I cannot disable it, can I remove BB Press from the list of plugins that the system is encouraging the user to load? Again, I don’t mean that I want to just remove it from the menu. I want to instruct the underlying plugin loader to not suggest this plugin.

    Does that make sense?

    P.S. For whatever reason, I do not receive email updates for my forum posts even though I have the “Notify me” box checked. I have checked my spam filter and there are no notices there. If it makes a difference, I host email on Google Apps.

    in reply to: Disable Appearance > Install Plugins #365208

    Thanks Ismael. I get that I could just remove the menu item. I was hoping for a more elegant way to disable it entirely than the way I came up with. It sounds like you’re also saying there’s no way to delete the plugin from the list. Is that right?

    Thanks!

Viewing 27 posts - 211 through 237 (of 237 total)