WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] twentyten argument in comments callback (6 posts)

  1. FenyX
    Member
    Posted 3 years ago #

    Hi,

    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() ) ); ?>
    </div>

    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.

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    it localization

    For translation of displayed text.

    It refers to the text domain

    http://wordpress.org/search/l10n

    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

  3. FenyX
    Member
    Posted 3 years ago #

    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() ); ?>

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Yup, parenthesis are balanced, looks good

  5. FenyX
    Member
    Posted 3 years ago #

    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!
    ;-)

  6. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Sure, glad to help

Topic Closed

This topic has been closed to new replies.

About this Topic