Support » Themes and Templates » twentyten argument in comments callback

  • Resolved FenyX



    I’m going to copy the Twenty Ten theme’s comment callback code lines to use on my own theme’s functions.php but… I’m unable to understand if removing the ‘twentyten’ argument could cause a problem because I just don’t know for which reason it’s used here. Example with the Twenty Ten functions.php:

    <div class="comment-author vcard">
    <?php echo get_avatar( $comment, 40 ); ?>
    <?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>

    So I would like to understand the use of ‘twentyten’ (after “says” span class), and above all I would like to know if I have to replace it with my own theme name, if I have to totally remove it or if it’s needed for the callback function to work.

    Any help would be welcome.

Viewing 5 replies - 1 through 5 (of 5 total)
  • it localization

    For translation of displayed text.

    It refers to the text domain

    if you copy it exactly, it won’t hurt anything…. if your theme uses localisation with a different text domain, you should swap that out….

    printf( __( '%s <span class="says">says:</span>', 'twentyten' ),

    would be

    printf( '%s <span class="says">says:</span>' ),

    without the translation stuff added (another bracket would need to be removed at the end of that whole line of code, to match the one I deleted

    If you are making a theme and ever plan to release it, localisation is an important thing to learn

    Thanks a lot for this infos. I’m just a PHP noob trying to modify a free theme according to his needs and tastes. And I translate the text strings directly in my theme’s PHP code

    So if I’ve well understood your advice about bracket, my example should look as bellow. That’s it?
    <?php printf( '%s <span class="says">says:</span>' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ); ?>

    Yup, parenthesis are balanced, looks good

    I will try to apply this rules to the rest of the callback script in my functions.php.

    I hate to don’t understand something, even after long search on the web, lol. So your help is really useful to me. One more time thank you Rev. Voodoo!

    Sure, glad to help

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘twentyten argument in comments callback’ is closed to new replies.