Remove "Leave a Comment' on Frontpage

  • aducale


    Hi there,

    Wondering if I could get a bit of help. I’ve searched the forum and haven’t been able to find info on this.

    I want to remove “Leave a Comment” from posts on the homepage that don’t have any comments yet. So, basically I only want it to show comment #s on posts that have comments and to be blank on posts that don’t have comments. Only on the frontpage.

    Let me know if this is possible. Or if you want further explanation.

    I attached a link to a screenshot to show you the desired result.



    I haven’t done this before… but the only way I can think is to create a custom function and “hook” it to the filter for showing comments.

    Something (in logical terms) like this…

    IF comments = 0, THEN hide the display of “leave a comment”.

    ELSE IF comments != 0, THEN show comment count.

    Note this isn’t a real function. Rather it’s just to point you in the right direction.

    You would still need to find the filter to use, and setup your function accordingly. Also, you would want to use a child theme so that your custom function is preserved during theme updates.

    This is tricky… and will require a fair amount of php knowledge.



    Thanks Josh. I’ll look into it more. A good start though.

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

  • You must be logged in to reply to this topic.