the_title_rss() outputs its value straight away so it can’t be used in a function like that, you would have to use get_the_title_rss()
Or alternatively the_title_rss() has a filter we can hook in to and return your shortened title is possible. (You would add this to your functions.php)
function gg_short_title_rss($title)
{
// This can return false, so check there is something
$short_title = substr($title, 0, strpos($title, ' –'));
if ($short_title) {
return $short_title;
}
// Else just return the normal title
return $title;
}
add_filter('the_title_rss', 'gg_short_title_rss', 10, 1);
Related Posts:
- Custom field in title
- Most efficient way to add javascript file to specific post and/or pages?
- Display all values of custom a field created with ACF on a page
- How to automatically apply woocommerce product title to all product images alt tags?
- If Custom Field is empty don’t display div
- How to make an meta_query optional?
- Add custom field to attachments in a specific category
- Blank on static home page?
- How can update custom meta for all posts
- “Maximum function nesting level of ‘100’ reached” after adding a new filter
- Unique key for each row in a repeater field
- String replace WordPress Site Title
- get_post_custom single array
- Make custom field meta not display if there is not data in it
- Customized title tag for each page in pagination?
- how to increase custom post value by one most efficiently?
- Passing the custom field values in the wp_get_current_user array function
- Custom profile field with birthday. Troubles with
- WordPress – Display array data of a child
- wordpress allow user to edit user profile with custom fields
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Change title only in dynamic page
- auto-populating custom nav with all items from custom post type
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- Which PHP page is the Default Posts Page
- Remove the last X characters of a custom field value
- Non-Closing PHP Query in WordPress Loop
- Find a way to retrive data updated through metabox plugin to web page
- Why are the details of my todo not saving?
- Can’t save php string to a custom field
- How to show/hide php table rows based on the content of custom fields
- Only show image from custom field when present
- how to get serialized post meta
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- How to show meta value code HTML after x paragraph
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Output custom text field as unordered list
- Conditional featured image with youtube thumbnail
- Order a WP_Query by meta value where the value is an array
- Add a custom class to the body tag using custom fields
- Add a counter for mouseovers (custom field)
- Show field if it has contents on Advanced Custom Fields
- the_meta – no get_the_meta query?
- Using an “IF” statement based on the existence of custom field
- Display additional user fields
- Dynamically added custom fields not displayed on WooCommerce email notifications
- Updating Metadata with Shortcode
- How can I add diffrent editable text fields?
- Add a “custom field” to a category that can be retrieved when viewing the category page with get_post_meta
- Include custom fields in search
- update_term_meta() only updating once on certain meta keys
- Trying to update Woocommerce meta values
- Posts title instead of Pages and Category titles – PHP WordPress
- Setting up a cron job to auto update a custom field
- How to Call on WordPress Custom Fields without a Plugin
- Query on a repeater date (acf)
- Time Stamp In A WordPress Post Title That Does Not Keep Refreshing
- Generating 3 random numbers and saving them in database
- ACF – Can’t get custom post type by taxonomy
- Save custom field on WP_List_Table
- Trying to retrieve meta values from three different meta keys and display in rows
- Site title not showing. Please help me
- WP post meta – for loop inside for loop
- How to display custom seo title before the loop?
- custom fields anchor points php
- Store custom field’s multiple values in one user meta key
- WooCommerce multiple custom fields code
- When working with a post, almost all wp_postmeta are deleted
- What syntax is this? “{{post.price}}”
- Updating Lat and Lng of posts automatically gives sporadic results
- WP_query meta_query slow with OR and DATES
- meta field for numerous links
- “Page Array” displaying in title bar on Front Page
- How to get the first letter from custom field?
- Meta box not saving spaces
- Display tab title as ‘blog tagline | blog title’
- divide custom field values in div every two values
- custom field meta-box with dropdown/autocomplete
- Showing custom field contents without listing description
- How to exclude post from being queried based on custom meta value
- How to link a word comprised of a custom field with another?
- If Elseif Query
- How to use custom fields to replace top-level parent title with an image using wp_list_pages?
- Hide page title
- Search result page – display values from the result’s metaboxes
- Display custom meta box in my template file
- Query posts by custom fields (object post)
- Too many if’s and else if’s ?? – Must be better way [closed]
- Advanced Custom Fields Show PHP in Text Areas
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- I want to show image from custom field image on my custom page template
- How do I organize posts based on their taxonomy?
- Custom Admin Menu Report for Specific User ID
- Shortcode Displays 2 times
- ACF number less than comparison not working
- wordpress-plugin (widget) that performs a Neaby-search on the openstreetmap-endpoint: around x find y
- Want to add custom post type for facebook feed
- Split titles by the ” – ” in WordPress
- Is it possible to remove the “Shop” title from the WooCommerce catalogue? [closed]