Removing meta, info and comments

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

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  braddalton 7 months, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #92364

    NWTD
    Participant
    Post count: 61

    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.

    • This topic was modified 7 months, 3 weeks ago by  NWTD. Reason: new findings
    • This topic was modified 7 months, 3 weeks ago by  NWTD. Reason: new findings
    #92394

    braddalton
    Participant
    Post count: 10165

    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/


    #92400

    NWTD
    Participant
    Post count: 61

    @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?

    #92417

    braddalton
    Participant
    Post count: 10165

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


    #92429

    braddalton
    Participant
    Post count: 10165
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.