Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1277928
    Karl K
    Participant

    Hi there,

    I’m currently displaying recent posts below post content using the following code in my functions.php file:

    function single_post_r_shortcode($contents) {
    	if(is_singular()) $contents .= do_shortcode('<h3>More From Guys Drinking Beer</h3>[ess_grid alias="recent"]'); 
    	return $contents;
    }

    Is there a way to hide this from our woocommerce product pages? Here’s an example: http://www.guysdrinkingbeer.com/product/homebrewers-almanac

    Thanks,

    Karl

    #1278093
    Friech
    Moderator

    Hi Karl,

    Thanks for writing in! Are you referring to the More From Guys Drinking Beer section? If so, you can add this under Custom > CSS in the Customizer.

    .single-product .x-tab-content .description_pane .myportfolio-container,
    .single-product .x-tab-content .description_pane h3 {
    	display: none;
    }

    Hope it helps, Cheers!

    #1278845
    Karl K
    Participant

    That did the trick! Thanks so much.

    #1278860
    Karl K
    Participant

    One quick follow-up, is there also a way to exclude pages from displaying the “More From…” too?

    #1278905
    Rahul
    Moderator

    Hey There,

    Thanks for writing back!

    Can you explain it a bit more so that we can give you a proper solution to it?

    Thanks for understanding!

    #1278917
    Karl K
    Participant

    Sure. Circling back up to the top of this thread, I am using the following code to display recent posts in an Essential Grid below post content.

    function single_post_r_shortcode($contents) {
    	if(is_singular()) $contents .= do_shortcode('<h3>More From Guys Drinking Beer</h3>[ess_grid alias="recent"]'); 
    	return $contents;
    }

    You can see an example at the bottom of this post: http://www.guysdrinkingbeer.com/the-green-lady-to-stop-selling-miller-products

    Is there a way to have this grid appear on posts and not pages? I am designing a shop page for Woocommerce using Essential Grid and the recent posts look out of place at the bottom of that page.

    Thanks.

    #1279228
    Friech
    Moderator

    Hi There,

    Please update your code to this:

    function single_post_r_shortcode($contents) {
      if(is_singular('post')) $contents .= do_shortcode('<h3>More From Guys Drinking Beer</h3>[ess_grid alias="recent"]'); 
      return $contents;
    }

    That should make the code apply only on the single post, not on products, nor pages.

    Hope it helps, Cheers!

    #1279253
    Karl K
    Participant

    Worked like a charm. Thanks for pulling through again.

    #1279489
    Friech
    Moderator

    We’re delighted to assist you with this.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1277928 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>