WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to add current "Year" in post title (8 posts)

  1. gholemu
    Member
    Posted 3 years ago #

    Hi all,

    I want to add current year next to post title. Not talking about permalinks (year/postname/), but strictly about the title of the post, something like Post Tile - 2011.

    I've tried this thing already in the title div, doesn't seem to work: <?php the_time('Y') ?>

    Any other suggestions?

    Thank you!

  2. gholemu
    Member
    Posted 3 years ago #

    Ok, figured that out, it's working now. But All in One SEO "covers" it in the <title> tag. How can I make it work there aswell?

  3. JamiGibbs
    Member
    Posted 3 years ago #

    This should work:

    <div class="title">
    <h3><?php the_title(); ?> - <?php the_time('Y'); ?></h3>
    </div>
  4. JamiGibbs
    Member
    Posted 3 years ago #

    Do you mean All in One SEO doesn't display the year in the title tag, only the actual title?

  5. gholemu
    Member
    Posted 3 years ago #

    Thanks for your answer.

    I've tried the snippet above, it doesn't work, not sure why. I managed to have the year shown in the post title (Post title Year), but not in the browser.

    And yes, if I can't have it shown on WP, without AIOSP, then it would be nice to have it in AIOSP.

    I'm not sure I'm explaining myself clear enough since I'm not a programmer.

  6. gholemu
    Member
    Posted 3 years ago #

    This is the link (google shortened so it's not indexed by search engines) http://goo.gl/BppYE

    I want the year to appear in the browser title, either in WP/theme directly, either in AIOSP.

  7. gholemu
    Member
    Posted 3 years ago #

    Here's what I have now:

    <title><?php if (is_home()) : ?><?php bloginfo('name'); ?> - <?php bloginfo('description'); ?>
    <?php else : ?>
    <?php wp_title('', 'false'); ?> - <strong><?php the_time('Y'); ?></strong>
    <?php endif; ?></title>

    The title of the post appears on the browser, but the year doesn't.

    I've emphasised the year part.

  8. gholemu
    Member
    Posted 2 years ago #

    Guess it's not really possible at this point or there's too much work for an experiment. The topic needs to be closed.

    Thanks everybody for their support and advices.

Topic Closed

This topic has been closed to new replies.

About this Topic