Invalid title when using user defined fields
-
Hello!
First thanx for this great PlugIn!
I’m using user defined fields to change the post title for specific posts, e.g. adding “guest post” to the title, if the user defined variable ‘Gastbeitrag’ is set. See the code below.
// add text for guest post to title
add_filter( ‘the_title’, ‘ai_guest_post’ );
function ai_guest_post( $title )
{
global $post;$guest_post = get_post_meta($post->ID, ‘Gastbeitrag’, true);
if ($guest_post == ‘true’ && in_the_loop() )
{
$guest_text = “<br><span style=’font-size: 50%; font-style: italic’>Gastbeitrag</span>”;
return $title.$guest_text;
}return $title;
}But now when displaying a guest post I see the added “guest post” (‘Gastbeitrag’ in the code above) text for ALL posts in the TOP 10 list and not only for guest posts.
So it seems that TOP 10 uses the postId of the displayed post for all posts in the TOP 10 list when setting the title.
Any help would be appreciated!
Thank you very much
Horst
- The topic ‘Invalid title when using user defined fields’ is closed to new replies.