Hi guys,
Do you know if is it possible add the name of the tag in the post title?
Hi guys,
Do you know if is it possible add the name of the tag in the post title?
Someone can help me?
Thanks a lot
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?
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...
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...
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"
This topic has been closed to new replies.