Archived topic
Can't find inc/template-tags.php
3 replies · Started by Peter on April 17, 2020
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.
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/
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.
That file doesn't exist in the theme, we may just need to update the inline docs :)