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


10

I'll take another shot. The following should modify the main query, such that it will include in its loop any posts that belong to no term of the Edition custom taxonomy. add_filter('pre_get_posts','better_editions_archive'); function better_editions_archive( $query ) { if ( $query->is_tax( 'edition' ) && $query->is_main_query() ) { ...


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

First step: remove the feed links from the section of your site. <?php add_action( 'wp_head', 'wpse33072_wp_head', 1 ); /** * Remove feed links from wp_head */ function wpse33072_wp_head() { remove_action( 'wp_head', 'feed_links', 2 ); remove_action( 'wp_head', 'feed_links_extra', 3 ); } Next up, let's remove the feed endpoints from WP. ...


7

First set the post type to display on main feed page i.e. /feed using pre_get_posts hook $q->set('post_type', array('post', 'page')); On individual page WordPress shows comment feed then set it to false and display page content in feed. $q->is_comment_feed = false; In feed template WordPress calls the_excerpt_rss() which calls get_the_excerpt() ...


6

WordPress bundles and wraps SimplePie class for feed download, caching and processing. Retrieving namespaced data with it would be something like this: $feed = fetch_feed( 'http://www.wdcdn.net/rss/presentation/library/client/iowa/id/128b053b916ea1f7f20233e8a26bc45d' ); $items = $feed->get_items(); foreach ( $items as $item ) { $credit = $item->...


6

A long time ago WordPress did not put feed links into the head element automatically. Theme or plugin authors had to do that. In 2009 automatic_feed_links() was introduced, a function that should be used in themes or plugins to let WordPress do the hard work. One year later it was added to Twenty Ten, and it became a de facto standard. Not much later ...


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

Ok, found. I spent hours on this but I managed to find the solution. The command I was looking for was $rss->enable_order_by_date(false);. So you should set (for benefit of the community): <?php /* include the required file */ include_once(ABSPATH . WPINC . '/feed.php'); /* specify the source feed */ $rss = fetch_feed('FEED_URL'); ...


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

Simple answer is yes you can. :) First check out Wordpress's codex here on their RSS feeds. http://codex.wordpress.org/WordPress_Feeds Then what you can do is change the default head rss links that let browsers know that there is an RSS feed. In your theme find: <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo ...


4

function remove_comment_feeds( $for_comments ){ if( $for_comments ){ remove_action( 'do_feed_rss2', 'do_feed_rss2', 10, 1 ); remove_action( 'do_feed_atom', 'do_feed_atom', 10, 1 ); } } add_action( 'do_feed_rss2', 'remove_comment_feeds', 9, 1 ); add_action( 'do_feed_atom', 'remove_comment_feeds', 9, 1 );


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

This may not be ideal, but it is a beginning. First make sure that the full content is in the feed: function fullcontentfeed($content) { global $post; $content = $post->post_content; return $content; } add_filter('the_excerpt_rss', 'fullcontentfeed'); You should then see the full feed at this url http://swissaudio.com/craftsmanship/...


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

You can, but you shouldn't. RSS feeds are built in XML. Not in HTML. Links in XML don't have meaning because they're HTML elements. However, because XML can be read by most HTML parsers (i.e. web browsers), you can easily mistake an XML document for an HTML one (the prevalence of XHTML helps to blur this line even further). In reality, though, no one ...


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

Tricky. It lumps categories and tags together pretty good. Had couple of approaches here is least messy: add_filter('the_category_rss', 'remove_rss_categories'); function remove_rss_categories( $the_list ) { $categories = get_the_category(); foreach ($categories as $category) $the_list = str_replace("<category><![CDATA[{$category-...


3

Here are some reasons I think FB does well: feed statistics: subscribers, item view and clicks email subscription: control email template, subscribers sharing posts on social networks with FeedFlare monitize with Google Adsense reduces CPU usage on your host. Some of above features you can do with plugins, but it costs CPU usage and sometimes host space. ...


3

Feed templates are special case. You can't simply provide your own template - you need to work with do_feed_ hooks to change handler function. But for your specific question it is much easier to override author. Try this (not tested): add_filter( 'the_author', 'feed_author' ); function feed_author($name) { if( is_feed() ) return 'Acme, Inc.'; ...


3

Adding the following code to your theme's functions.php will solve your problem: // Add Pages to RSS Feeds function myfeed_request( $qv ) { if ( isset( $qv['feed'] ) && ! isset( $qv['post_type'] ) ) $qv['post_type'] = array( 'post', 'page' ); return $qv; } Found code here.


3

Full Text Feed plugin shows full content....follow the installation steps there,and then goto settings->Reading->For each article in a feed, show=>select Full text and save.it'll work.if you want to implement via the code means, <?php if (get_option('rss_use_excerpt')) : ?> <description><![CDATA[<?php the_excerpt_rss() ?>]]>&...


3

There are three simple steps to get what you want: Hook into 'template_redirect' to act before the feed is displayed. If it is a feed send a 404 status header and load the 404 template. Here is a simple plugin that does it: <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 404 Feed * Description: Sends a 404 status code for all feeds and loads ...


3

You have add_feed('feedname', 'my_feed'); but no my_feed function to actually generate the feed output. Create a my_feed function and have it call the template to generate the feed output. Like this: function my_feed() { include 'path-to-that-template-file.php'; } add_feed('feedname','my_feed'); Then regenerate your permalinks, one time only, by ...


3

To make the choice for users as simple as possible, I recommend using only one feed link. Even I am always confused when having to choose between RSS, RSS 2.0 and Atom. Are there still readers out there that don't understand all three different formats? Whether it links to FeedBurner or not depends on your personal preferences. FeedBurner has advantages: it ...


3

The code you posted will do exactly what it says it will - prevent anyone from accessing your site via an RSS feed. Still there is tons of transient options.. like _transient_feed_mod or _transient_timeout_feed_mod These transient options have absolutely nothing to do with your site feed. The WordPress dashboard consumes several feeds by default and ...


3

The AJAX request would query for the dates it requires to display. With Lazy fetching set, if you switch from month to week or day views it won't bother making another request, since it doesn't need to. This is outlined in the fullcalendar documentation. As for using this method, see this question on how to obtain the admin-ajax.php url properly. Next, you ...



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