baszer
Member
Posted 6 months ago #
Hello,
I have a custom post type called books. I use the futured image also with this custom post type. I want to have it's own RSS Feed. I came accros this piece of code:
// THIS INCLUDES THE THUMBNAIL IN OUR RSS FEED
function insertThumbnailRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'insertThumbnailRSS');
add_filter('the_content_feed', 'insertThumbnailRSS');
But how can I add the images to my custom feed for books?
Photoshop Tutorials
Member
Posted 6 months ago #
Not sure what you trying to do. Do you want to add the thumbnails only to the Custom post rss feed?
This is how you will get the rss feed for a CPT
http://www.yoursite.com/feed/?post_type=books
if you want to add the thumbnail only on the CPT RSS then change your if statement to
if ( has_post_thumbnail( $post->ID ) && $post->post_type == 'books' ){
// codes
}
Hope it will help. let me know if you have any questions. Thanks.
baszer
Member
Posted 6 months ago #
Thank you for your reply.
I want a thumbnail on all my RSS (posts and CPT), because I load some categories to another website.
So I have to combine your code with the code above?
Photoshop Tutorials
Member
Posted 6 months ago #
So, the current code you are using doesn't add the thumbnail to the CPT feed? Is that what you were asking?
It will be also helpful i can see the rss. Do you have any live site?
baszer
Member
Posted 6 months ago #
Thanks for helping me. I still didnt at the code, because I dont really know where to put it.
This is my website: http://www.despekbraander.nl/dewolden/
Photoshop Tutorials
Member
Posted 6 months ago #
Okey, then add the first bit of code on your themes functions.php file and reply back here.
baszer
Member
Posted 5 months ago #
hmmm, when I put in the first piece of code nothing works on this website http://www.despekbraander.nl/test/
What do I do wrong?
Photoshop Tutorials
Member
Posted 5 months ago #
No its working. The code is for adding thumbnail on feed which it did..
check here http://www.despekbraander.nl/test/feed/
Now make new custom post "books" and add some post thumbnail to it. It should work too.
baszer
Member
Posted 5 months ago #
cool, but now another problem. I now have the post on my other website, but the thumbnail is not a thumbnail anymore. It is now just an image in the post. How can I still use the thumbnail as a thumbnail on the new website.
example:
It goes from: http://www.despekbraander.nl/dewolden/
to http://www.despekbraander.nl/test
Photoshop Tutorials
Member
Posted 5 months ago #
You can just save the image and upload it again on new site as a thumbnail image.
Are you loading the post via some plugin?