• Resolved ejm

    (@llizard)


    My theme is a child of twenty twelve. I have exhaustively searched in these forums and on the rest of the internet as best I can to locate the answer.

    I am trying to change the string “your comment is awaiting moderation” that appears in /wp-includes/comment-template.php

    I do not know where to place any alteration into comments.php in my child theme (perhaps it is within wp_list_comments?) However, ideally, this change should take place in my child theme’s functions file.

    After staring at the Twenty Twelve Functions Page at gist.github.com/DanielSantoro/bde3601e1c5b58b30f43, I’ve guessed that the function might be in twentytwelve_comment( $comment, $args, $depth ) With several trials and no fatal errors (and no string change) I have managed to get this far with my twenty twelve child’s functions.php:

    /*...............
    change "awaiting moderation" string on comment form
    ...............*/
    function mytwtwchildtheme_comment($comment) {
    	if ( '0' == $comment->comment_approved ) : ?>
    				<p class="comment-awaiting-moderation"><?php _e( 'All comments are moderated. But as soon as your comment has been approved, it will be displayed universally.', 'twentytwelve' ); ?></p>
    			<?php endif; 
    }
    add_filter('twentytwelve_comment','mytwtwchildtheme_comment');
    

    While this does not throw any errors, it does not change the string either. Can someone please point me to how to achieve what is probably an insanely easy fix?

    Please bear in mind that I only know enough about php coding to get myself in trouble. Having things spelled out is welcome.

    Thank you.

    -E Morris, etherwork [dot] net [slash] blog << purposely unlinked in attempt to keep spammers at bay (there’s a really good reason that I have WordFence plugin that helped enormously to rid me of bruteforce attacks….)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The string you are trying to change is part of core WordPress, not the theme.
    It is easy to change it with a plugin like https://www.ads-software.com/plugins/say-what/

    Thread Starter ejm

    (@llizard)

    Thank you for your response, Joy.

    Because this is just a simple cosmetic change to some arbitrary wording in the WP core, , I was hoping to be able to achieve this without a plugin. My experience, over the years with WP, is that many plugins lose their support when their authors disappear.

    Thread Starter ejm

    (@llizard)

    Excuse me for replying to myself.

    I installed the Say What plugin to use until I learn how to achieve this without a plugin.

    However, my definition of “easy-to-use” is radically different from Lee Willis’ definition of “easy-to-use”. There is zero support for how to locate “text domain” or “text context” for the string “Your comment is awaiting moderation” that is located in wp-includes/comment-template.php.

    Because this is just a simple cosmetic change to some arbitrary wording in the WP core, , I was hoping to be able to achieve this without a plugin.

    You could change the core file, but it will get overwritten when WP updates.
    But think about what you are saying here. Adding code to your site has to happen somewhere outside of core (since it will be overwritten). You have a choice of theme, plugin, mu-plugin. Themes shouldn’t have functionality, so that you can switch themes at any time without losing functionality. That leaves plugins. And what is better than having someone else figure out how to do it and then using that? So what if they no longer support it? You didn’t have to write it yourself. You can always copy a plugin and change it to your liking. At least the author figured out how, tested it, and released his code to a repository that has a code review before it can be listed.

    If you have a problem with a plugin, please create a topic on the plugin’s support forum. Let them know it doesn’t make sense. Perhaps they will fix it or explain.

    • This reply was modified 5 years, 8 months ago by Joy.
    Thread Starter ejm

    (@llizard)

    Re:

    what is better than having someone else figure out how to do it and then using that?

    This is exactly why I have come into the wp forum. I had hoped to locate the fix to put into my theme’s functions.php. I tried one more thing (I have used this method successfully for 3 other strings.) Sadly, this does NOT work to change “your comment is awaiting moderation” string.

    // https://ronangelo.com/change-or-translate-text-on-a-wordpress-theme/
    
    function e2019_change_text4( $change_text4 ) {
    	if ( $change_text4 == 'Your comment is awaiting moderation' )
    	{
    		$change_text4 = 'All comments are moderated. But as soon as your comment has been approved, it will be displayed universally.';
    	}
    	return $change_text4;
     }
    add_filter( 'gettext', 'e2019_change_text4', 20 );
    

    Because I have zero desire to switch themes at any time, for now, it is looking like I will have to resort to modifying the core file, with careful notes to myself so that I will know where I modified it.

    If the Say What plugin really was simple to use, I would use it instead.

    Thank you for your replies, Joy. I will move my queries about the plugin over to Say What forum.

    Thread Starter ejm

    (@llizard)

    I was mistaken about the location of the string “Your comment is awaiting moderation.” It is in /themes/twentytwelve/functions.php.

    If anyone knows how, or can point to a page outlining how, to change the child functions file so that the string changes, I would be most appreciative.

    (So far, the only suggestion at the Say What forum is that I pay for the Pro version of the plugin.)

    Thread Starter ejm

    (@llizard)

    Once again, please excuse me for replying to myself. Unfortunately, The Say What plugin did not work for me at all. I haven’t succeeded in changing the string, in spite of finding various methods for finding and replacing the string, including an earlier (2006) post specific to showing a similar string at lorelle.wordpress.com/2006/07/26/your-comment-has-been-moderated-stay-tuned-for-approval/.

    However, as a compromise, I used “before” and “after” on the class “comment-awaiting-moderation” in the CSS to put the following into my theme’s stylesheet.

    
    .comment-awaiting-moderation::before { 
      content: "Please note: ";}
    
    .comment-awaiting-moderation::after { 
      content: " (It may take a little time. But as soon as your comment has been approved, it will be displayed universally.)";}

    So, while there is still no answer to the original question, I’m going to mark this thread as resolved.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘how to change “awaiting moderation” string?’ is closed to new replies.