Add to title outside of loop
-
I am making a plugin to modify any title. Basically I want to add some text at the end of a title if the user is logged in and the content contains a certain string inside of it, outside of the loop. So far I am using:
add_filter(‘the_title’,’myfunction’);
and it works inside of a loop, but if I have a plugin like YARPP, which pulls the related posts to the current post. I want to check the content of those posts for “{DO NOT SHOW TO EVERYONE}” and if it sees that string then have title change from:
“Twitter has it’s ups and downs”
to
“Twitter has it’s ups and downs *”Anyone have any ideas? Or do I need to do a custom wpdb call to check the contents of the titles being pulled?
This might sound very confusing, but that is what I am right now, confused.
- The topic ‘Add to title outside of loop’ is closed to new replies.