Remove comment-meta div from comments section

Community Forums Forums Design Tips and Tricks Remove comment-meta div from comments section

This topic is: resolved

This topic contains 6 replies, has 3 voices, and was last updated by  deconq 1 year, 3 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #7822

    deconq
    Participant
    Post count: 17

    I want to delete the comment-meta div that displays the comment date. I know this can be easily done with CSS display:none, but Google has been fetching dates from the comments section on my Pages and adding them into its search results, which is OK for my Posts but not for my Pages. I therefore want to know how to fully delete the comment-meta div from the HTML of my pages, not just hide it with CSS. Thanks.

    #8026

    Riavon
    Participant
    Post count: 95

    Under Genesis / Theme settings scroll down to where you see “Comments and Trackbacks” and untick Enable Comments for Pages.


    Twitter: @riavonentprises

    #8093

    deconq
    Participant
    Post count: 17

    I don’t understand how you can get ‘I want to turn off comments’ from what I wrote. That’s not what I asked and you would understand that if you read my question carefully.

    What I want to do is delete the comment dates.

    #8130

    Riavon
    Participant
    Post count: 95
    This reply has been marked as private.
    #8136

    nickthegeek
    Keymaster
    Post count: 751

    Sorry for the confusion on this. Sometimes it takes a bit of back and forth to make sure your issue is clearly understood, especially with something that has a very complicated answer.

    Seriously, this customization is one of the more advanced ones. You will need to make a custom comment callback. Start by opening the genesis/lib/structure/comments.php file. You won’t be editing the file but you need some of the code from there.

    You also need to open the child theme functions.php file. Because of the nature of this you should probably use FTP to open the files involved.

    Add this to the child theme file

    add_filter( 'genesis_comment_list_args', 'child_comment_list_args' );
    function child_comment_list_args( $args ) {
        $args['callback'] = 'child_comment_callback';
    
        return $args;
    }
    

    This changes the “callback” for the comment list so now it is looking for the child_comment_callback function to process the comment list output. You will need to make this function. In the genesis/lib/structure/comment.php file find the “genesis_comment_callback” function and copy the entire function into your child theme functions.php file.

    In the child theme file, rename that function to child_comment_callback and edit it to remove the comment date output or make that conditional for !is_page() and make any other changes you wish to make.

    After you are finished save the changes you made to the functions.php file.

    #8239

    deconq
    Participant
    Post count: 17

    Nick: Thanks for your help and your time, I’m going to implement what you’ve said and hope it works. :)

    #8247

    deconq
    Participant
    Post count: 17

    Worked perfectly.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Remove comment-meta div from comments section’ is closed to new replies.