WordPress.org

Ready to get started?Download WordPress

Forums

PubSubHubbub
Patch to allow pshb on categories (1 post)

  1. emmanuel.nhan
    Member
    Posted 3 months ago #

    Hello,

    Here is a short patch to apply on pubsubhubbub.php to allow pshb on feeds of categories.

    Index: pubsubhubbub.php
    ===================================================================
    --- pubsubhubbub.php    (révision 914416)
    +++ pubsubhubbub.php    (copie de travail)
    @@ -32,9 +32,9 @@
     function pshb_publish_post($post_id) {
       // customize default feeds
       $feed_urls   = pshb_get_feed_urls();
    +  $cat_feed_urls = pshb_get_cat_feed_urls($post_id);
    +  pshb_publish_to_hub(array_merge($feed_urls, $cat_feed_urls));
    
    -  pshb_publish_to_hub($feed_urls);
    -
       return $post_id;
     }
     add_action('publish_post', 'pshb_publish_post');
    @@ -137,6 +137,18 @@
       return apply_filters('pshb_feed_urls', $feed_urls);
     }
    
    +function pshb_get_cat_feed_urls($post_id) {
    +  $feed_urls = array();
    +  $categories = get_the_category($post_id);
    +
    +  foreach($categories as $cat) {
    +    $feed_urls[] = get_category_feed_link($cat->cat_ID, 'rss2');
    +  }
    +
    +  return apply_filters('pshb_cat_feed_urls', $feed_urls);
    +
    +}
    +
     // helper function to get comment-feed urls
     function pshb_get_comment_feed_urls() {
       // we want to notify the hub for every feed

    Don't hesitate to point me to another location to submit my contribution.

    Cheers

    https://wordpress.org/plugins/pubsubhubbub/

Reply

You must log in to post.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 3 months ago by emmanuel.nhan
  • This topic is not resolved
  • WordPress version: 3.7.1