WordPress.org

Forums

Putting normal text in your blog (4 posts)

  1. Nos402
    Member
    Posted 10 years ago #

    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.

  2. 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.

  3. Nos402
    Member
    Posted 10 years ago #

    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>

  4. Cypher
    Member
    Posted 10 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.