I’m not 100% sure as I’ve never had any issues with that code on any site.
I wonder if your theme is using the_excerpt_rss for some reason?
What theme are you using? Also, if you switch to twentyeleven for a moment just to test, does the problem go away?
I am using the magazine style Mimbo theme.
When I switch to twenty eleven yes the problem goes away.
I just found out that there is a line of code in the header which includes ‘the_excerpt_rss’
http://pastebin.com/67T2y75z
That’s not related. It’s trying to output a meta description for your site’s pages and won’t impact on your RSS feed.
Hmmm….
I think that if an image is filtered onto the_excerpt_rss, and added into that meta description through that, it may jack things up…
you have a link to see your source code?
However it displays the excerpt on top of the page when viewing post with an thumbnail attached to it.
Tsk! Bad Voodoo 😉 Just realised you’re altering the_excerpt_rss – which is fine if your theme doesn’t use it anywhere but the RSS feed. However, in theory, this should just bork the meta description – not the feed, yes?
Just a hunch but, in the code you posted above, try changing:
<meta name="description" content="<?php the_excerpt_rss(); ?>" />
to:
<meta name="description" content="<?php strip_tags( the_excerpt_rss() ); ?>" />
Yup, it’s definitely conflicting….
<meta name="description" content="<img width="600" height="472" src="http://matvarupriser.se/nyhetsrum/wp-content/uploads/2011/09/Annelieframtidensmat.jpg?e2686d" class="attachment-post-thumbnail wp-post-image" alt="Annelieframtidensmat" title="Annelieframtidensmat" />Annelie Hellström, VD för FramtidensMat, i krönikan: Gåvan att få bidra till ett enklare liv med goda middagar!
" />
Is what is getting output to your head….
I’m not totally sure how to go about fixing it, I’ve never used the_excerpt_rss within a theme…. I don’t think swapping that out for the_excerpt will work, I think that would bring in other stuff….
So would this code be the best solution for this
<meta name=”description” content=”<?php strip_tags( the_excerpt_rss() ); ?>” />
@esmi just saw your post. I believe that it only did bork the theme, not the feed.
Is there a better way to get where I’m going? Images in the rss feeds? If so, I’m all ears!! er… eyes!
@erikhgm: It should work. At worst, it won’t help but it shouldn’t break anything else.
I just tried changing the code but its the excerpt still shows up.
Could I just remove the line?
technically
<?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<meta name="description" content="<?php the_excerpt_rss(); ?>" />
<?php endwhile; endif; elseif(is_home()) : ?>
<meta name="description" content="<?php bloginfo('description'); ?>" />
<?php endif; ?>
Could be removed entirely…. that just sets up meta description
An SEO plugin (such as Yoasts WordPress SEO) could add in the descriptions if you want them, probably more effectively
It’s up to what you wish to do
Also, if there is a way to improve my code up above for putting images into the rss feed, I’d love to see that to.