WordPress.org

Support

Support » How-To and Troubleshooting » Putting normal text in your blog

Putting normal text in your blog

  • If I want to add some normal text into my blog (for example putting the word “Archives:” before the archive links) do I need to use the php _e(‘text’); to do so? I know that if I just put the text in, that it will work, but I didn’t know if that was bad form from a standards viewpoint or something. Thanks!

    I’m a total WP newb, newly migrated from many years in MT land.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator James Huff

    @macmanx

    Support Team Rep.

    That depends on how the titles in your sidebar are layed out. Sometimes it’s:

    <li><h2><?php _e('Archives'); ?></h2>

    And, sometimes it’s:

    <li id="archives"><?php _e('Archives:'); ?>

    And, sometimes it’s:

    <h2 class="sidebar-title">Archives</h2>

    And, sometimes it’s completely different. If you stick with the titling scheme that your theme’s sidebar uses, you’ll be fine.

    I was really just asking more in general. If I want to add some text into my main.php or any of my theme files, is it ok to just plug text in between the php tags? For example, in my post footer I like to have a “|” divider between each element, so I currently have:

    <div class=”blogfooter”>Posted @ <?php the_time() ?>
    <?php _e(‘ | ‘); ?><?php the_category(‘,’); ?><?php _e(‘ | ‘); ?><?php comments_popup_link(__(‘Comments (0)’), __(‘Comments (1)’), __(‘Comments (%)’)); ?>
    <?php _e(‘ | ‘); ?><?php edit_post_link(__(‘ Edit This’)); ?><?php wp_link_pages(); ?>
    </div>

    but would it be OK to just have:
    <div class=”blogfooter”>Posted @ <?php the_time() ?>
    | <?php the_category(‘,’); ?> | <?php comments_popup_link(__(‘Comments (0)’), __(‘Comments (1)’), __(‘Comments (%)’)); ?>
    | <?php edit_post_link(__(‘ Edit This’)); ?><?php wp_link_pages(); ?>
    </div>

    You are free to add text of the like you’ve been adding to your code. But just to let you know the _e() function is used for language conversion.

    That is, if you enclose words within _e(‘xx’);, then it will be translated to whatever your blog’s language is. So if you wanted to put “Archives” here, and changed to Spanish, it will become Archives in Spanish or German or whatever.

    Putting “|” doesn’t do anything for you cuz there isn’t any real translation for it.

    No harm in using _e for it, but just thought you should know.

    Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Putting normal text in your blog’ is closed to new replies.