Hot answers tagged

15

Hi @curtismchale: Piggybacking off @prettyboymp's excellent answer,with my spin on it, here's how you can do multiple custom fields (I did 3, you can do more): add_action('rss2_item', 'yoursite_rss2_item'); function yoursite_rss2_item() { if (get_post_type()=='my_custom_post_type') { $fields = array( 'field1', 'field2', 'field3' ); $post_id = ...


14

function add_custom_fields_to_rss() { if(get_post_type() == 'my_custom_post_type' && $my_meta_value = get_post_meta(get_the_ID(), 'my_meta_key', true)) { ?> <my_meta_value><?php echo $my_meta_value ?></my_meta_value> <?php } } add_action('rss2_item', 'add_custom_fields_to_rss'); You should be ...


8

Without knowing what your post_gallery filter function does, there's no way to give a proper answer. However, if you are using the post_gallery filter, and returning new markup, then yes, it will be used in feeds too. The code you mention commenting out happens after the post_gallery filter, and won't get executed at all if you're returning a different ...


8

You should be able to use pre_get_posts and set the posts_per_page to 50 conditionally (on being feed for categories). Unfortunately there is this unresolved trac ticket. The only work-around is to do hook into post_limits and replace the LIMIT part of the SQL query directly. add_action('post_limits','wpse71759_category_rss_limit',10,2); function ...


7

RSS2 is the modernized version of the legacy format, atom is a more recent competing format. Both are read by all commonly used feed parsers. You'll run into a fanboy here and there that will try to convince you that one is better than the other. In reality it makes no difference whatsoever. Use the default. Or toss a coin to pick one.


7

This is a really cool idea. I don't think part 2 should be handled inside WordPress: there are plenty of RSS to email providers. They're going to be way better at that than a plugin (or theme) is likely to be. BUT we can create RSS feeds. Step one: set up a class to wrap everything up. There are a few class constants and variables here -- we'll use them ...


6

The Solution WordPress 3.1 Taxonomy Feeds Plugin (Must Use) Put that must-use plugin on your site and request: http://blog.example.com/feed/?taxonomy=taxonomy-name as you asked for it. Detailed Information Wordpress offers requesting the feed with multiple configurations. Finding Your Feed URL (Wordpress Codex) shows what is possible. Next to the ...


6

In your functions.php add: function excludeFeedCats($query) { if ($query->is_feed) { $query->set('cat','-3, -12'); } return $query; } add_filter('pre_get_posts','excludeFeedCats'); Or use Simply Exclude for more flexibility.


6

According to the Codex, fetch_feed() uses the SimplePie engine for parsing RSS. So, if $item->get_title(); is working, then you should be able to do: $item->get_thumbnail(); as per the SimplePie documentation, as long as there are any thumbnails already on the feed. UPDATE: Before running the above, you have to insert the images on your feed. ...


6

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>' . ...


5

If your question is more like "which format is most widely used and supported?", then I got a pretty good answer for you: I analyzed the world's 50 most read blogs according to Technorati, and found that 9 (18%) offered Atom feeds while 48 (96%) offered RSS feeds. I've also never heard about a feed reader that doesn't support RSS (although I haven't tried ...


5

SimplePie, which ships with WordPress, does support images in feeds. Please see the SimplePie Reference if you need to look for specific functions regarding images. If you want to display images from feeds on your own site, you could for example create a plugin containing a custom widget that reads a feed for images. For example with the get_feed_tags() ...


5

Here is how to create a custom feed: first create a new file in your theme's directory , name it your-custom-feed.php and put this code inside <?php /** * custom RSS feed. * * @package WordPress */ header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); $more = ...


5

You want to use paged not page in the request and it should work. You can find more information about WordPress pagination paged parameter here.


4

function add_featured_image_url($output) { global $post; if ( has_post_thumbnail( $post->ID ) ){ $output = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ) . ' ' . $output; } return $output; } add_filter('the_excerpt_rss', 'add_featured_image_url'); add_filter('the_content_feed', 'add_featured_image_url');


4

Maybe this might help: http://wordpress.org/support/topic/how-to-create-rss-feed-that-includes-multiple-categories


4

THANK YOU THANK YOU for this excellent piece of information. I wanted to extend what the other two have written already... For this to validate, you must have a custom namespace. Here's how you do that: /* IN ORDER TO VALIDATE you must add namespace */ add_action('rss2_ns', 'my_rss2_ns'); function my_rss2_ns(){ echo 'xmlns:mycustomfields="'. ...


4

Unfortunately, what you're trying to do is generally frowned upon in most communities. What I hear you asking for is: A way to remotely retrieve more than the default number of (recent posts) Possibly retrieve all published posts for a site Without having any direct interaction with the site itself (using RSS) This is a practice commonly used to scrape ...


4

You won't need browser detection, RSS (as XML) can be styled without losing compatibility with machine readers. I believe the format for that is XSLT. Unfortunately I have little hands on experience with XSLT and none in context of WordPress feeds, so can't give solid example.


4

Each YouTube video has 4 generated images. They are predictably formatted as follows http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg http://img.youtube.com/vi/<insert-youtube-video-id-here>/3....


4

They don't normally show there That is how they are supposed to work. Each CPT has a feed of it's own by default Everything in WP has a feed it seems! But if you want them in your main feed this can go in your functions.php // ADDS POST TYPES TO RSS FEED function myfeed_request($qv) { if (isset($qv['feed']) && !isset($qv['post_type'])) ...


4

To add your complete content to your RSS feed, go to Admin >> Settings >> Reading >> For each article in a feed, show >> Full text


4

Here is a list of points that will help you in order to make an iOS app for your WordPress blog: You can either parse XML in the RSS feed, JSON by installing a JSON plugin in your WordPress or you can also parse HTML directly. 1) I would suggest using NSXMLParser and parse the RSS feed instead of using JSON. Reason being, if something goes wrong to the ...


4

Feeds are not stored, WordPress generate them on request. That means that even if WordPress can generate 4 type of feed, that does not affect in any way performance, but gives the possibility to users to choose a format they like according to reader they are using: is not WordPress fault if there are different types of feed standard. The WordPress preferred ...


4

Alright kids, we're gonna leverage a couple of awesome WordPress features today. First things first, let's get that custom feed registered with add_feed: /** * Register "my_feed". */ function wpse_226681_register_feed() { // do_feed_rss() loads the default RSS template in WordPress add_feed( 'my_feed', 'do_feed_rss' ); } add_action( 'init', '...


4

Atom vs RSS2 Let's look at the wp-includes/feed-atom.php and wp-includes/feed-rss2.php files. The updated element of the Atom feed entry is: <updated><?php echo mysql2date( 'Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false ); ?></updated> The pubDate element of the RSS2 feed item is: <pubDate&...


3

Yes. The fact of the matter is that people will want to use both for different reasons. Google, for example, converts all RSS feeds to Atom before using them in Google Reader. WordPress, for example, can only read RSS feeds in its built-in feed readers (try importing a Google-ified feed into WordPress and everything breaks!). But which style you use is a ...


3

There is a plugin for this, RSS Icon Widget. However it looks like it hasn't been tested on any version past 2.8. It looks fairly simple, so it could still work. Otherwise the easiest way to accomplish this is to just create a new text widget and write the HTML to display any icon you'd like and link it to your feed. A plugin may even be overkill for this. ...


3

If you want to be able to see which of your visitors have subscribed in GA, you need to call an event, a virtual page or a custom variable using an onclick event. Probably best to use an event, so add something like this to the link: <a href="subscribe link" onclick="_gaq.push(['_trackEvent', 'Subscribe', 'RSS', document.location.pathname]);">...



Only top voted, non community-wiki answers of a minimum length are eligible