• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Removing meta, info and comments

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Removing meta, info and comments

This topic is: not resolved
  • This topic has 4 replies, 2 voices, and was last updated 8 years, 11 months ago by Brad Dalton.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • February 25, 2014 at 5:26 pm #92364
    NWTD
    Member

    I'm customizing the Entreprise theme. I created a page template to be used by single posts of a certain category. I had to add this filter to my functions.php to make it work:

    add_filter('single_template', create_function('$t', 'foreach( (array) get_the_category() as $cat ) { if ( file_exists(STYLESHEETPATH . "/single-{$cat->term_id}.php") ) return STYLESHEETPATH . "/single-{$cat->term_id}.php"; } return $t;' ));

    All changes I've made to that template thus far have worked just fine. I'm currently attempting to remove the post's info, meta and comments for these particular posts. I tried adding the following to the template referenced above, with no go:

    remove_action( 'genesis_after_post', 'genesis_get_comments_template' );
    remove_action( 'genesis_before_post_content', 'genesis_post_info' );
    remove_action( 'genesis_after_post_content', 'genesis_post_meta' );

    I then tried adding thefollwing to my functions.php, again, with no luck:
    add_action( 'wp_enqueue_scripts', 'afn_custom_remove_comments' );

    function afn_custom_remove_comments() {
        if(in_category( 'monthly-special' ) )  {
    		remove_action( 'genesis_after_post', 'genesis_get_comments_template' );
    		remove_action( 'genesis_before_post_content', 'genesis_post_info' );
    		remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
    	}
    }

    Any suggestions?

    Edit
    I was able to "remove" the info and meta using the following:

    add_filter('genesis_post_info', '__return_false');
    add_filter('genesis_post_meta', '__return_false');

    However, that just removed the output, and the HTML markup is still present.

    February 25, 2014 at 10:38 pm #92394
    Brad Dalton
    Participant

    You could do this from your functions file using the is_page_template() conditional or you'll find code on this post which you can add to your template file for HTML 5 or XHTML child themes, the code is different http://wpsites.net/web-design/modify-post-info-genesis/


    Get Help – Book Consultation.

    February 25, 2014 at 11:00 pm #92400
    NWTD
    Member

    @braddalton Thank you!!!

    I swear I scoured the documentation and couldn't find anything relating to the HTML5 version of the codes. The only thing I haven't been able to find is how to remove comments from just this category. Did I miss that in the link you sent?

    February 26, 2014 at 12:08 am #92417
    Brad Dalton
    Participant

    Try adding a conditional tag with the category i.d or slug to the code and filter the output removing the comments shortcode.


    Get Help – Book Consultation.

    February 26, 2014 at 12:56 am #92429
    Brad Dalton
    Participant

    This may help http://wpsites.net/web-design/remove-genesis-post-info-post-meta-conditionally/


    Get Help – Book Consultation.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble