GithubHelp home page GithubHelp logo

cabrerahector / wordpress-popular-posts-feed Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 3.0 31 KB

Adds a Popular Posts RSS feed to your WordPress powered site.

License: GNU General Public License v3.0

PHP 100.00%
wordpress plugin popular posts feed rss

wordpress-popular-posts-feed's Introduction

Popular Posts RSS feed for WordPress

Adds a Popular Posts RSS feed to your WordPress site.


Table of contents

Description

Popular Posts Feed is a WordPress plugin that adds a popular posts feed to your WordPress-powered web site.

Requirements

Installation

  1. Git clone this repository into your /wp-content/plugins directory. Alternatively, you can also grab the zip file from the latest release page and then follow the manual plugin installation instructions.
  2. Go to Plugins, find the Popular Posts Feed plugin and click on Activate to enable it.
  3. Go to Settings > Permalinks and click on Save Changes to flush WordPress' permalinks rules and have it detect the new feed.
  4. Visit <your domain name>/feed/popular-posts/ using your browser. If everything went OK, you'll be able to see the popular posts feed right away.

Upgrading

  1. Go to the latest release page and download the attached zip file from the Assets section.
  2. Deactivate and uninstall your current version of the Popular Posts Feed plugin.
  3. Manually install the plugin zip file you just downloaded.
  4. Go to Plugins and activate the Popular Posts Feed plugin.
  5. Go to Settings > Permalinks and click on Save Changes to flush WordPress' permalinks rules.

Customization

The plugin includes various filter hooks that you can use to customize your popular posts RSS feed. Generally speaking though, the one you'll likely want to use is popular_posts_feed_args.

Hook into popular_posts_feed_args to:

  • Change the number of items displayed in the feed.
  • Change the post type (default is post).
  • Have the feed return popular posts from a given taxonomy (category, post_tag, or even a custom taxonomy!)
  • Change the Time Range (default is most popular posts from the past 7 days).
  • Have the feed return popular posts from a given author.
  • etcetera.

The popular_posts_feed_args accepts pretty much the same parameters used by the wpp_get_mostpopular() template tag from the WordPress Popular Posts plugin.

Here's an example:

/**
 * Have the WPP feed display the 10 most popular posts
 * from category ID 7 from the past 30 days.
 */
function wp3951_my_popular_feed_options( $args ){
    $args['range'] = 'last30days';
    $args['limit'] = 10;
    $args['taxonomy'] = 'category';
    $args['term_id'] = 7;

    return $args;
}
add_filter('popular_posts_feed_args', 'wp3951_my_popular_feed_options', 10);

For more filter hooks, have a look at the feed.php file included with the plugin.

Contributing

  • If you have any ideas/suggestions/bug reports, and if there's not an issue filed for it already (see issue tracker), please create an issue so I can keep track of it.
  • Developers can send pull requests to suggest fixes / improvements to the source.

wordpress-popular-posts-feed's People

Contributors

cabrerahector avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

wordpress-popular-posts-feed's Issues

Render thumbnail

Hi,
Thanks for the plugin..

It's working great, but I was in the need to also print the thumbnail of the post.
Was looking for how to do this, and found this code for using on our theme functions.php

function rss_post_thumbnail($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '<p>' . get_the_post_thumbnail($post->ID) .
'</p>' . get_the_content();
}
return $content;
}
add_filter('the_excerpt_rss', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');

It works for the "general" feed of the website, but for the popular posts feed the thumbnail image is rendered always the same one, from the last published post.

I believe that it concerns the line "global $post;" line that gets the latest post, not the other being used on the loop..

Have any suggestion how could it also render the post thumbnail?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.