[Resolved] Can't find inc/template-tags.php

Home Forums Support Can't find inc/template-tags.php

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1242918
    Peter

    I have made sure that I have hidden files showing, but I can not locate the file inc/template-tags.php referenced in the comment.php file “* See generate_comment() in inc/template-tags.php for more.” Note; I am a beginner with coding and php.

    I want to change the wording for “Comment awaiting moderation” for a post type, preferably through elements. So far I have been unable to make the change using code in elements (changed most of the other labels this way successfully). I still would like to make the change using elements, but now I am thinking I will need to make the change by adding an if statement for post type in the template-tags.php – but I can not find the referenced inc/template-tags.php file.

    Any help appreciated.

    #1243594
    Tom
    Lead Developer
    Lead Developer

    Hi Peter,

    Best to use a filter to do this.

    Try this:

    add_filter( 'gettext', function( $text ) {
        if ( 'Your comment is awaiting moderation.' === $text ) {
            $text = 'Your new text';
        }
    
        return $text;
    } );

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

    #1243679
    Peter

    Thank you Tom, that worked. I still can not find the inc/template-tags.php file. I do not need it now, again thank you, but I might still need to make changes in the future.

    #1244449
    Tom
    Lead Developer
    Lead Developer

    That file doesn’t exist in the theme, we may just need to update the inline docs 🙂

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