Feedburner RSS not showing images from posts
Website: http://windows7design.com/
I add there images using custom field: preview images are: post-img
Then: http://feeds.feedburner.com/Windows7Design
is not showing that images
Erez S answers:
put the following code in your functions.php file in your theme folder:
function insert_img($content) {
$img = '<img src="'.get_post_meta(get_the_ID(), 'post-img', $single = true).'" alt="'.get_the_title().'" /><br />';
$content = $img.$content;
return $content;
}
add_filter('the_excerpt_rss', 'insert_img');
add_filter('the_content_rss', 'insert_img');
that sholud work
coxis comments:
erez213 please post full functions.php file for me
<?php
/**
* @package WordPress
* @subpackage Windows7Styles_theme
*/
automatic_feed_links();
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name'=>'Left',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
register_sidebar(array(
'name'=>'Right',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
}
?>
i will then swap it and check if that works
coxis comments:
http://feeds.feedburner.com/Windows7Design
not ideal but something is going on
coxis comments:
this is the problem: url to image:
http://feeds.feedburner.com/img/Leopard_Dark_for_Windows_7_by_sagorpirbd.jpg
and it should be: http://windows7design.com/img/Leopard_Dark_for_Windows_7_by_sagorpirbd.jpg
Erez S comments:
<?php
/**
* @package WordPress
* @subpackage Classic_Theme
*/
automatic_feed_links();
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '',
'after_title' => '',
));
function insert_img($content) {
$img = '<img src="'.get_post_meta(get_the_ID(), 'post-img', $single = true).'" alt="'.get_the_title().'" /><br />';
$content = $img.$content;
return $content;
}
add_filter('the_excerpt_rss', 'insert_img');
add_filter('the_content_rss', 'insert_img');
?>
That should work(fix the image url).
Enjoy
Erez S comments:
My bad,this is the right code:
<?php
/**
* @package WordPress
* @subpackage Windows7Styles_theme
*/
automatic_feed_links();
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name'=>'Left',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
register_sidebar(array(
'name'=>'Right',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
}
function insert_img($content) {
$img = '<img src="'.get_option('siteurl').'/'.get_post_meta(get_the_ID(), 'post-img', $single = true).'" alt="'.get_the_title().'" /><br />';
$content = $img.$content;
return $content;
}
add_filter('the_excerpt_rss', 'insert_img');
add_filter('the_content_rss', 'insert_img');
?>
coxis comments:
i am here, just upload the newest version of your code, waiting for RSS update to see if this work, keep my fingers crossed
http://feeds.feedburner.com/Windows7Design
coxis comments:
sorry but the problem is still there: http://feeds.feedburner.com/Windows7Design
Erez S comments:
That should work for sure:
<?php
/**
* @package WordPress
* @subpackage Windows7Styles_theme
*/
automatic_feed_links();
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name'=>'Left',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
register_sidebar(array(
'name'=>'Right',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
}
function insert_img($content) {
$img = '<img src="'.get_bloginfo('template_url').'/'.get_post_meta(get_the_ID(), 'post-img', $single = true).'" alt="'.get_the_title().'" /><br />';
$content = $img.$content;
return $content;
}
add_filter('the_excerpt_rss', 'insert_img');
add_filter('the_content_rss', 'insert_img');
?>
Erez S comments:
i see that my solution had worked , enjoy :)
coxis comments:
like Christian said i post static src to template img folder
but now i switch that to your code
anyway i want to tnx you for helping and give this small award to you, i just asked Christian if he is ok with that, because he also helped me alot
tnx for putting this to work !!!
one more question, so i don't need to use plugin: Custom Fields for Feeds & Get Custom Field Values , only your code yes
Erez S comments:
no,only my code
coxis comments:
i am going to kill myself really
i've changed from summary to full RSS and images gone away:
http://feeds.feedburner.com/Windows7Design
what i've done more is delete those 2 plugins...
what more i don't know, i've lost image, don't know really what happaned
Erez S comments:
if you switch to sumarry,the images will back?
Erez S comments:
and if it still dont work,try to install those plugins again
coxis comments:
when i put it to summary images come back !
coxis comments:
everything would be good with only summary: http://feeds.feedburner.com/Windows7Design
but the test , post is not formatted at all
it is only formatted when i use full post
Erez S comments:
<?php
/**
* @package WordPress
* @subpackage Windows7Styles_theme
*/
automatic_feed_links();
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name'=>'Left',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
register_sidebar(array(
'name'=>'Right',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
}
function insert_img($content) {
if(is_feed()){
$img = '<img src="'.get_bloginfo('template_url').'/'.get_post_meta(get_the_ID(), 'post-img', $single = true).'" alt="'.get_the_title().'" /><br />';
$content = $img.$content;
}
return $content;
}
add_filter('the_excerpt_rss', 'insert_img');
add_filter('the_content', 'insert_img');
?>
try this with full content
coxis comments:
it is working great !
tnx
Japh answers:
The reason your images are not appearing in the RSS feed is because they are in a custom field and not a core part of the post, so your RSS feed doesn't know about them.
You can work around this with a plugin called [[LINK href="http://justintadlock.com/archives/2008/01/27/custom-fields-for-feeds-wordpress-plugin"]]
Custom Fields For Feeds[[/LINK]]
If you need more assistance on how to use this plugin other than what's on that site, there's also a blog post here that explains how to use it for images: [[LINK href="http://dodesign.us/blog/custom-field-images-in-wordpress-feeds/"]]Custom Field Images in WordPress Feeds[[/LINK]]
I hope that helps :)
coxis comments:
Well i saw that plugin on google and tried to make it work but my main question was for whole answer, i mean to find a solution (working) for my site.
coxis comments:
if you need i can provide you proper access to my server
coxis comments:
I tried the solution from your link, but still nothing on my RSS.
I've changed:
$image = get_post_meta($post->ID, 'POST_IMAGE_URL', $single = true);
to:
$image = get_post_meta($post->ID, 'post-img', $single = true);
upload that: http://coffee2code.com/wp-plugins/get-custom-field-values/
but still no images in my RSS
kjll kll answers:
Quick solution...
<strong>try this:</strong>
Use your "meta" image as you did it before but,
put it inside the posting as a core part too like that:
<img href="IMAGEURL" class="myrssimg" />
Now add the following line to the css file of your theme
.myrssimg
{
display: none;
}
Now if someone is having a look at the rss feed the image is shown, but if someone does look at the actual homepage the image is hidden...
coxis comments:
No good, i will need to edit all posts ! to apply this one..
kjll kll comments:
Normaly rss feeds are mainly used for future posts ... so... but i'll have a lok for another solution if I'm at home
coxis comments:
cool, tnx
what is strange .. that author of this theme (coder) put the same stuff with custom field images on other site and there RSS is ok
kjll kll comments:
Add this to your functions.php
function cf_addtorss($content) {
global $wp_query;
$postid = $wp_query->post->ID;
$post_image_url = get_post_meta($postid, 'POST_IMAGE_URL', true);
if(is_feed()) {
if($post_image_url !== '') {
$content = "<p><img src='".$post_image_url."' /></p>".$content;
}
else {
$content = $content;
}
}
return $content;
}
add_filter('the_excerpt_rss', 'cf_addtorss');
add_filter('the_content', 'cf_addtorss');
kjll kll comments:
This works for me
coxis comments:
i've added your code to functions.php
rss is there , but without images !
the best code was erez213 , but there was problem with:
this is the problem: url to image:
http://feeds.feedburner.com/img/Leopard_Dark_for_Windows_7_by_sagorpirbd.jpg
and it should be: http://windows7design.com/img/Leopard_Dark_for_Windows_7_by_sagorpirbd.jpg
kjll kll comments:
What is the meta key of the images?
post-img
or
POST_IMAGE_URL
?
And, is the solution erez213 added still active?
coxis comments:
post-img is custom field for preview images
but i change yours:
function cf_addtorss($content) {
global $wp_query;
$postid = $wp_query->post->ID;
$post_image_url = get_post_meta($postid, 'post-img', true);
if(is_feed()) {
if($post_image_url !== '') {
$content = "<p><img src='".$post_image_url."' /></p>".$content;
}
else {
$content = $content;
}
}
return $content;
}
add_filter('the_excerpt_rss', 'cf_addtorss');
add_filter('the_content', 'cf_addtorss');
coxis comments:
i don't know WTF is going on, it was working this morning with wrong URL to image, but it was working, now i cannot see images with wrong URL, the code is the same .. don't know how the hell put this to work
kjll kll comments:
Are you using full posts or excerpts for the rss feed?
coxis comments:
ok it is working one more time:
http://feeds.feedburner.com/Windows7Design
i use full post
to put this to work i change some option in http://feedburner.google.com/ setup
i think not the option is important, but only that i've change something there it start working with @erez213 code, now the only thing that is wrong is:
url to image:
http://feeds.feedburner.com/img/Leopard_Dark_for_Windows_7_by_sagorpirbd.jpg
and it should be: http://windows7design.com/img/Leopard_Dark_for_Windows_7_by_sagorpirbd.jpg