Here is a great example. How to display featured post thumbnails in WordPress feeds
paste this code snippet in your theme functions.php file
// display featured post thumbnails in WordPress feeds
function wcs_post_thumbnails_in_feeds( $content ) {
global $post;
if( has_post_thumbnail( $post->ID ) ) {
$content="<p>" . get_the_post_thumbnail( $post->ID ) . '</p>' . $content;
}
return $content;
}
add_filter( 'the_excerpt_rss', 'wcs_post_thumbnails_in_feeds' );
add_filter( 'the_content_feed', 'wcs_post_thumbnails_in_feeds' );
Related Posts:
- Aspx/Rss feed – failed to open stream: Redirection limit reached
- How to access all meta data for RSS feed?
- Custom gallery in wp3.5
- How can I modify footer when footer.php calls to another file?
- Noscript not working as it should in wordpress site
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- How to set the WordPress logo programmatically with PHP
- Function works everywhere, how to keep it to execute when creating a new post
- How to use theme function in post/page?
- esc_url( ) won’t use https
- Function won’t run onclick using Ajax
- Add login hyperlink to secondary navigation menu
- Content filter won’t work
- Where is this function’s callback getting its arguments from?
- Why does the post_type_link hook everything twice?
- Warning: in_array() null given in PHP function
- Use post ID in functions.php file adminside
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- List all blogs, but exclude the main site
- use loop to return blog details
- How can I count ACF sub_field with a certain value
- change the default order of posts only for specific categories
- Reading settings in the home page precisely home.php
- Fetching Initials of the Commentator in the WordPress Website
- Adding function to child theme’s function.php
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Calling function in loop causes repeat data
- Missing a text-domain esc_attr_e
- Custom posts password protect
- How to get post category list as select in front-end?
- How to use functions [closed]
- Splitting the_content() by size?
- Is there a hack for using is_page() within the function.php file?
- Extract and display user infromation on an automatically created page
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- How can I assign separate stylesheets to different pages?
- Add a select-option to the default widgets
- Function to call either single post or category
- Execute PHP code only with specific user role
- WP Container Displaying Only on First Page of Archive
- Updating Metadata with Shortcode
- can’t load .po file in functions.php
- WP-Bakery – Add custom colors to buttons with template colors
- WordPress User Meta value variable into Google Gauge Chart
- Woocommerce – Exclude variation attribute on specific variation
- How do I add a function to parent theme
- Are there any drawbacks on opening a session_start in functions.php and header.php?
- Create shortcode for metabox gallery
- Show all people who commented on all posts by an author
- WordPress create custom XML RSS feed template
- PHP function for horizontal Woocommerce thumbnails and badges
- Add Pre-Defined Value to Click Counter in WordPress
- How can I redefine WordPress wp-content directory programmatically?
- Trim Titles Only On Some Pages
- Custom global variable not working in function
- WooCommerce display price before add to cart [closed]
- Show sidebar only to author of post
- How to move a post from one category to another
- Show data obtained from a function and place it in a shortocode function
- get_the_author_meta( ‘ID’ ) just return 1
- how to add custom select field to wordpress edit page
- How to override theme’s public static function inside of a trait?
- Delete empty title_tags, find a h1 heading and echo it
- Enqueue sripts and styles only if function is called
- how to use 2 index.php file One for mobile and one for desktop
- Site title not showing. Please help me
- Check if post visited first time
- WP_Query To Display Product Of Brand On Taxonomy Page
- ajaxurl usage for a custom function
- Store custom field’s multiple values in one user meta key
- oembed facebook link?
- Open/closed function [closed]
- Need to Echo A Url path to show on a wordpress page
- How can I export data without using any import/export plugin
- Search for images that width and height is more than 500
- add a value to an external link query in searchform
- Restrict File Type Uploads by User on Wordress via functions.php
- How to Request a User to Register on Landing at a Site, Then Automatically Delete the Users Password on Logout?
- Matching multi user
- Add disclaimer before certain posts and pages
- AJAX Returning Way Too Many Posts
- auto metakey value on post tile
- How do I routinely extract the thumbnail of the most recent post?
- wordpress ajax return 0
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- site_url() returns with additional backslashes
- Overwriting a Shortcode
- How to get category pages to look like a certain archive page?
- Search box background on a different page template
- WP Ecommerce: Display the “Order Notes” as column in the Sales Log [closed]
- How to call a specific value within the functions.php file?
- Select area and checkbox data is not saving?
- A next page function with shortcode?
- Suppress errors when using global function
- What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]
- Warning: Attempt to read property “term_id” on int – Woocommerce
- Warning: filemtime(): stat failed for wp_
- Keep users logged in Without Remember Me
- How to use js variable to php in wordpress functions.php
- Too few arguments to function woocommerce_update_product_acf_save_post()