WordPress.org

Ready to get started?Download WordPress

Forums

Add to title outside of loop (2 posts)

  1. Fill in the Blank
    Member
    Posted 5 years ago #

    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.

  2. Fill in the Blank
    Member
    Posted 5 years ago #

    I want this to work for all plugins that pull a title as well. Doesn't look like that is possible because they all pull the title differently. Maybe I have to actually physically add or remove the information into the DB. Then it will work for everything. But then I have to do a bunch of DB calls all over the place...

    Please someone offer me some guidance...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.