WordPress.org

Forums

PubSubHubbub
Patch to allow pshb on categories (3 posts)

  1. emmanuel.nhan
    Member
    Posted 1 year 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/

  2. pfefferle
    Member
    Plugin Author

    Posted 8 months ago #

    Sorry for the late reply! what do you think about a separate plugin that implements a whole bunch of extra feeds, to keep the default list simple and short???

  3. pfefferle
    Member
    Plugin Author

    Posted 8 months ago #

    btw: the plugin is also hosted on github... feel free to contribute :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic