RSS Feed Edit Content – Custom Fields, etc…
-
Hi,
I’m trying to grab post custom fields in the rss feed.
I added this code in the function.php (in this case the custom field is : address)function wpbeginnerb_postrss($content) { global $wp_query; $postid = $wp_query->post->ID; $address = get_post_meta($postid, 'address', true); if(is_feed()) { if($address !== '') { $content = '<br /><span style="margin-top:0px; margin-left:164px; font-size:12px; font-family: Tahoma bold; color: #000000;">'.$address .'</span><br />'.$content ; } else { $content = $content; } } return $content; } add_filter('the_excerpt_rss', 'wpbeginnerb_postrss'); add_filter('the_content_feed', 'wpbeginnerb_postrss');
I found it here https://www.wpbeginner.com/wp-tutorials/how-to-add-content-and-completely-manipulate-your-wordpress-rss-feeds/ in the section “Add a Custom Field to your WordPress RSS Footer” but I edited it to not show in the footer but somewhere before the content (I added style in the span tag). Here is my sample email template: E-mail
Now I’m wondering if I can move the custom field above the Title and not above the Content, should I change $content with $title….
Thanks so much
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘RSS Feed Edit Content – Custom Fields, etc…’ is closed to new replies.