Happy Halloween! Get 20% off GP Premium with the discount code: HALLOWEEN20

[Support request] Comments showing in the wrong place on blog posts

Home Forums Support Comments showing in the wrong place on blog posts

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #310201
    wekhter

    Just switched to GeneratePress on a live site and somehow the comments are showing up in the wrong place on blog posts. Eek!

    Here’s an example page:

    http://www.gozen.com/9-things-every-parent-with-an-anxious-child-should-try/

    I’ve been preparing for this theme switch for a while on a local site and never ran into anything like this.

    GeneratePress 1.3.46
    GP Premium 1.2.96
    #310213
    Leo
    Staff
    Customer Support

    Hi there,

    Can you explain a little more? I see the comments below the posts.

    Let me know 🙂

    #310234
    wekhter

    Hi Leo, I set the comment area to clear:both so at least it wouldn’t look as insane (as it’s a live site), but you should be able to see that on that page the comments are preventing the sidebar from being in the proper place.

    If you look in the source code, you’ll see that, quite literally, the comment area is not nested where it should be. I’ve managed to narrow this down to probably being an issue with this plugin: https://wordpress.org/plugins/add-widget-after-content/

    … Which is weird, because I’ve been testing with that plugin in mind on a local site for weeks now! It looks like on any post where that widget is enabled, the whole page layout gets screwy.

    The reason I have that plugin installed is to let me have content on most posts, but with the ability to disable it sometimes–just like how the GP “Disable Elements” works. Is there a way I can hook into the Disable Elements feature and add in my own custom widget (that can be disabled on a per-post basis) to bypass whatever this plugin is doing?

    Also, is there a way to programmatically disable certain elements by default? For instance, automatically disabling navigation on certain page templates.

    #310254
    Leo
    Staff
    Customer Support
    #310273
    Tom
    Lead Developer
    Lead Developer

    You could basically use the register_sidebar() function register a new widget area, then add it below the content using Hooks.

    Then the plugin Leo suggested will allow you to show/remove the widgets in that newly created area.

    #310282
    wekhter

    Thanks, I can get something worked out from that.

    Question: I want to change the display of the secondary navigation, not the primary navigation. I see from the docs the primary navigation filter is generate_navigation_location is the secondary one generate_secondary_navigation_location ?

    #310334
    Tom
    Lead Developer
    Lead Developer

    That filter doesn’t exist currently.

    However, you could this:

    add_filter( 'option_generate_secondary_nav_settings','tu_secondary_nav_location' );
    function tu_secondary_nav_location( $options ) {
    	
    	$options[ 'secondary_nav_position_setting' ] = 'secondary-nav-below-header';
    	return $options;
    }

    These are the available options:

    secondary-nav-below-header
    secondary-nav-above-header
    secondary-nav-float-right
    secondary-nav-left-sidebar
    secondary-nav-right-sidebar
    #310706
    wekhter

    First of all: turns out the comments thing wasn’t any sort of plugin issue, it was 100% my fault. Whoops! But with your help I was able to just set up a sidebar instead of having another plugin installed, so all’s well that ends well.

    Secondly: Thanks! That code is exactly what I was looking for. Here’s what I ended up with, in case it can help someone else:

    add_filter( 'option_generate_secondary_nav_settings','tu_secondary_nav_location' );
    function tu_secondary_nav_location( $options ) {
    	
      if ( is_page( 'page-slug' ) || is_singular( array ( 'cpt1', 'cpt2' ) ) || is_post_type_archive( 'cpt1' ) ) {
    	$options[ 'secondary_nav_position_setting' ] = 'secondary-nav-below-header';
    	return $options;
      }
      
      else {
    	$options[ 'secondary_nav_position_setting' ] = '';
    	return $options;
      }
      
    }

    This way I have the secondary nav show up for certain post types (and a paage) that need it, but doesn’t show up anywhere else. 🙂

    BTW–I only just realized that tu_ is Tom Usborne. Seems so obvious now!

    EDIT: Just noticed that secondary nav inline CSS still loads on pages w/o secondary nav–not really a huge deal but is there a way to disable that as well?

    #310772
    Tom
    Lead Developer
    Lead Developer

    Not currently, but I’ll look into that 🙂

    Glad everything else is working! 🙂

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.