WordPress.org

Support

Support » Themes and Templates » Name Tag on Post Title

Name Tag on Post Title

Viewing 9 replies - 1 through 9 (of 9 total)
  • Someone can help me?

    Thanks a lot

    Michael

    @alchymyth

    Forum Moderator

    can you elaborate on your question?
    example for instance?

    do you mean: tag as in taxonomy?

    Example:

    I have a post with title:”Good life” which has one tag:”Past”

    I want that the tag title will be:”Past: Good life”, is it possible?

    Michael

    @alchymyth

    Forum Moderator

    instead of
    <?php the_title(); ?>

    you could try and use:

    <?php $posttags = get_the_tags();
    if ($posttags) {
    foreach($posttags as $tag) {
    echo $tag->name . ': '; break;
    }
     } ; the_title();  ?>

    Doens’t work…

    Michael

    @alchymyth

    Forum Moderator

    the code needs to be in the loop.

    what in particular does not work?
    can you post the inserted new code with a few lines before and after ?
    or link?

    What i want is to insert the title in tag title of the header, not title in loop…

    Michael

    @alchymyth

    Forum Moderator

    small adaptation – check for single post, and use the post id in ‘get_the_tags()’:

    <?php if(is_single()) { $posttags = get_the_tags($post->ID);
    if ($posttags) {
    foreach($posttags as $tag) {
    echo $tag->name . ': '; break;
    }
     } ; the_title(); } ?>

    Doens’t work… 🙁
    Edit: it works but not with plugin “all in seo pack”

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Name Tag on Post Title’ is closed to new replies.
Skip to toolbar