[Resolved] Where to add a ‘filter’ snippet?

Home Forums Support [Resolved] Where to add a ‘filter’ snippet?

Home Forums Support Where to add a ‘filter’ snippet?

  • This topic has 7 replies, 3 voices, and was last updated 2 years ago by Leo.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2167771
    Martin

    Sorry if this is a numpty question but where can I add this (to change the title of comments form):

    add_filter( 'generate_comment_form_title', function() {
        return 'What do others say';
    } );

    Thanks.

    #2167787
    Martin

    Thought I would update this as I realised the filter mentioned above relates to the ‘comments title’ (where the submitted comments are displayed). What I want to change is ‘Leave a Comment’.

    And what I also what to do is allow Feedback but not display the feedback on the posts as they are purely for admin reference and serve no purpose to public viewers.

    Thanks.

    #2167790
    Martin

    Found it:

    add_filter( 'generate_leave_comment','tu_custom_leave_comment' );
    function tu_custom_leave_comment() {
        return 'Join the conversation';
    }

    And to not show comments on the front-end I’ve simply made them require approval.

    I’ll leave this here in case anyone else find it useful.

    #2167817
    David
    Staff
    Customer Support

    Hi there,

    glad to hear you found the answer you were looking for.

    For reference that code is PHP and this doc explains how to add it to your site:

    https://docs.generatepress.com/article/adding-php/

    #2167819
    Martin

    Thanks David.

    Is there a hook or filter that allows me to ensure no comments are displayed on posts even though we allow comments to be submitted?

    #2167829
    David
    Staff
    Customer Support

    Just to be clear – you want to keep the Comment Form but not display the Comments ?

    #2167835
    Martin

    Yes. That’s correct.
    If I rely on comments staying ‘unapproved’ someone might approve a comment (which I’m not actually using as ‘comments’ – they are related to business).
    If one gets ‘approved’ I don’t want it to be visible.

    #2168239
    Leo
    Staff
    Customer Support

    Hmm it’s unconventional to do that but try this CSS:

    .comments-title, .comment-list {
        display: none;
    }

    Adding CSS: https://docs.generatepress.com/article/adding-css/

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.