PrependandAppendTexttoWordPress? Titles

Source: Internet
Author: User
Readthefullarticleat: cannot informationto? Posttitleswhenthey? ShowupinRSSfeeds.

Read the full article at: Prepend and Append Text to WordPressTitles I was thinking about little ways to improve my blog and one small enhancement I wanted to make was adding more information? Post titles when they? Show up in RSS feeds.

Read the full article at: Prepend and Append Text to WordPress Titles


I was thinking about little ways to improve my blog and one small enhancement I wanted to make was adding more information? Post titles when they? Show up in RSS feeds .? Something about policying the user via title outside of the site itself seemed like a good idea .? For example, some posts are just small "quick tips", and more readers may take the time to peruse it quickly because they know it won't take too long .? Here's how I accomplished that feat with WordPress.

The PHP

The first step is creating a function, which is provided the post title and ID, that does a category check and? Prepends text accordingly:

function show_as_tip_in_feed($title, $id) {if(is_feed() && in_category('tips', $id)) {$title = 'Quick Tip: '.$title;}return $title;}

Once the function is there,?add_filterHook? Enables the original function:

if(function_exists('add_filter')) {add_filter('the_title', 'show_as_tip_in_feed', 10, 2);}

Of course you don't need to do the category check or RSS feed check-you can append or prepend text to any and every title, and much like other WordPress functionalities ,? The API easily allows developers to do so .? Win!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.