Since you’re defining $post_type
, why not just use it instead?
function wpbeginner_titlerss($content) {
global $wp_query;
$post_type = $wp_query->post_type;
if( $post_type == 'essays' ) {
$content="Essay: ".$content;
}
elseif ( $post_type == 'gallery' ){
$content="Gallery: ".$content;
}
elseif ( $post_type == 'games' ){
$content="Game: ".$content;
}
else {
$content = $content;
}
return $content;
}
add_filter( 'the_title_rss', 'wpbeginner_titlerss' );
(This assumes you have created custom post types, essays
, gallery
, and games
.)
Related Posts:
- RSS for Pages Instead of Posts?
- Show ‘Read more’ in rss feed
- Posts gathered from WPEMatico feeds are being mixed in different languages. Polylang is used for language separation
- Problem with articles feed: XML Parsing Error: XML or text declaration not at start of entity
- How to preserve HTML from posts in RSS feed
- How to include Related Posts in WP RSS feed
- How to get a post content from another wordpress blog/site?
- Create pretty permalink for a post knowing the permalink structure
- Post update RSS notification plugin
- get_the_content_feed with paginated posts
- filter RSS feed in URL
- ERROR: Your feed is invalid (after update WP4.7) in custom types
- date issue with category post retrival
- Cannot retrieve a custom RSS field from posts
- Automatically Import WordPress Blog to Facebook Page [closed]
- Remove password protected posts from default RSS feed
- Creating separate feeds for custom post types
- Image on rss feed on post
- Publish a Silent Post without updating Feed
- How can my plugin display a populated new post window
- How can I create an RSS feed that includes “Private” posts?
- fetching posts and showing on frontpage
- How do I keep raw HTML in my RSS feed and not lose my paragraph breaks?
- Every time I try accessing a post it redirects me to the feed
- How can I have the posts from one word press blog show on the presentation page of another word press site
- Get image paths from RSS feeds
- How to get override the WP Admin Syndication feed limit for a custom feed?
- Add News Feed to bespoke website, only to one page on whole site
- Filter question list on substring of metavalue
- Code works on a page but not in a widget
- Send the post id to a front end edit post form
- Embedding Facebook in blog post not working
- How to filter out post from a category not its subcategory in wordpress dashboard
- WordPress loop uses unmodified posts array, why?
- Add a meta to a post submited from a frontend form
- Static text above category page
- Create new post on user registration
- How can you control what a user is allowed to post in the backend?
- List posts of assigned categories in list of all categories on single.php
- Can I use wp_widget_rss_output to show my site’s feed in the dashboard?
- Ajax – Post Categories and Load More
- Display result of custom form
- wp query custom orderby not custom field
- All my posts don’t show, only the headline is displayed on the homepage
- How to enable comments meta box for other author posts?
- How can I choose and change a post title at random from an array when it is published?
- WP Blog Page Problems – Been stuck for a week
- Everytime I create my Events page, it shows up as an archive post instead of an actual page
- Add meta box for Featured Image caption in wp-admin/post-new.php
- Querying multiple categories in the WP loop if one of the category IDs is dynamically obtained
- Add review box by function at top or bottom of content
- Add category information beneath post?
- Error after saving or updating post
- Any difference betweenn posts and pages for one page?
- Custom Post Type doesn’t use single.php or single-{custom_post_type}.php
- get backup file from wordpress database in x days
- How to change number of posts shown on homepage vs other pages?
- Disable archiving of old posts?
- Customizing individual images on posts
- Post are not showing up
- Posts are printed twice
- How to display most popular posts from certain category in sidebar?
- Is possible to do this from function.php
- Remove All in One Seo from Posts for Contributors
- Front end post delete error confirmation and success message
- Add row after three columns
- Hook To Get All Posts Deleted
- Difficulty in creating and handling a complex post type
- How can I set and update the the_date according to a custom field of the post
- WordPress The Next Posts
- Display WordPress Post By Date
- Send Newsletter-Email when post changes
- How to show content of specific item on the same page?
- Show short text of content
- Admin is showing all posts on page 1
- update post category in a new table on frequent change of category
- Query post for today, if no post get the previous one
- Need help writing loop to display posts by categories in separate divs
- Edit Posts Page but not category specific pages?
- Embed button for post screen
- Post Format problem
- How to create a Top 10 Popular Posts Page?
- Post title to show all characters after having it limited for preview
- Alternating Post Styles on Homepage
- How to retrieve custom field values and save again as array
- Related posts not working in the index
- Meta boxes not saving
- problem with creating a wordpress post slider
- Posts per page, reverse count
- Custom Select Query pagination not working properly
- Add category selection to function request
- structure of posts and pages
- How to change post template via url?
- Custom Single Post Type not referring to single-post-type.php File
- How to remove related post from home page
- Stop images from being displayed on the front-end of the site
- Password-protect feed and make it usable in major aggregators
- GUID to related post not in current language
- Get posts by category or author
- Display iframe or embeded posts on homepage