Remove links from titles of posts (4 posts)

  1. benjiw33
    Posted 7 years ago #

    I have a blog that I am essentially using as a backend for and RSS feed that gets processed into an email digest. I'd like to remove the title links from SOME posts so that they aren't included in the RSS feed, and hence the email that goes out. In other words, I want the RSS feed to contain only the post title and body, but no link back to the post in some instances.

    I've searched and searched but can't find a way to do this. Any help is much appreciated. Thanks.

  2. t31os
    Posted 7 years ago #

    I think (in that i'm not totally sure), you might be able to do somthing like this...

    <?php if(is_feed()) { echo the_title_attribute(); } else { the_title(); } ?>

    The title attribute as far as i can see only returns the title...

    This would replace your existing..

    <?php the_title(); ?>

    I'm not hugely familiar with how feeds work in WP, so i could be wrong, but give it a shot...

  3. benjiw33
    Posted 7 years ago #

    Thanks -- but wouldn't this change it so that none of the posts have title links? I only want this to apply to certain posts. Thanks much for your insight.

  4. t31os
    Posted 7 years ago #

    It would change it for all posts when viewed as a feed, i think...

    If you want it for a particular category then maybe something like...

    <?php if(is_feed() && is_category('yourcat')) { echo the_title_attribute(); } else { the_title(); } ?>

    Or you might need to use in_category...

    <?php if(is_feed() && in_category('yourcat')) { echo the_title_attribute(); } else { the_title(); } ?>

    Like i said, i'm not fully aware of how the WP feed functions work, so the above may not work at all. Give it a shot, if it doesn't work then just change it back...

Topic Closed

This topic has been closed to new replies.

About this Topic