Categorie

WordPress.com Popular Posts

IMPORTANT: due to my job, I’m now too busy to maintain my plugins.

This plugin has been abandoned!

If you are a developer and would like to fork, feel free to do so (under the GPLv3 license). No need to contact me.

WordPress.com Popular Posts integrates with WordPress.com Stats plugin, providing a widget to show the most viewed posts.

Installation

  • From v2.0.0, WordPress 2.8 is required. If you are using an older version of WordPress, use v1.3.5 of this plugin.
  • Install WordPress.com Stats plugin (required at least v1.2!!!)
  • Download WordPress.com Popular Posts
  • Extract the files in the .zip archive, and upload them (including subfolders) to your /wp-content/plugins/ directory
  • Activate the plugin through the ‘Plugins’ menu in WordPress
  • Place the widget where you like in your sidebars
  • Enjoy!

Themes Integration

If your theme supports widgets, you can place the widget named ‘Popular Posts’ where you want.

If it doesn’t, put this code inside the file sidebar.php, in your theme files:

<?php if (function_exists('WPPP_show_popular_posts')) WPPP_show_popular_posts(); ?>

Optionally you can add some parameters to the function, in this format:

name=value&name=value etc.

Possible names are:

  • title (title of the widget, you can add tags (e.g. <h3>Popular Posts</h3>) default: Popular Posts)
  • number (number of links shown, default: 5)
  • days (length of the time frame of the stats, default 0, i.e. infinite)
  • show (what you want to show; it can be: both, posts, pages; default is both)
  • format(the format of the links shown, default:
    <a href='%post_permalink%' title='%post_title%'>%post_title%</a>

    )

  • excerpt_length (the length of the excerpt, if %post_excerpt% is used in the format)
  • title_length (the length of the title links, default 0, i.e. unlimited)
  • exclude (the list of post/page IDs to exclude, separated by commas. Read the FAQ for instructions)
  • cutoff (don’t show posts/pages with a view count under this number, default 0, i.e. unlimited)
  • list_tag (can be: ul, ol, none, default ul)
  • category (the ID of the category, see the FAQ for info. Default 0, i.e. all categories)
  • cachename (it is used to enable the cache. Please read the FAQ).

You can use these special markers in the format value:

  • %post_permalink% the link to the post
  • %post_title% the title the post
  • %post_title_attribute%the title of the post; use this in attributes, e.g.
    <a title='%post_title_attribute%'...
  • %post_views% number of views
  • %post_excerpt% the first n characters of the content. Set n in the widget options.
  • %post_category% the category of the post
Example

If you want to show the widget without any title, the 3 most viewed articles, in the last week, and in this format: My Article (123 views) you will use this:

<?php WPPP_show_popular_posts( "title=&number=3&days=7&format=<a href='%post_permalink%' title='%post_title_attribute%'>%post_title% (%post_views% views)</a>" );?>
Shortcodes

If you want to include the list in a particular page or post, you can use shortcodes. Please read the FAQ for further info.

FAQ

Please read other updated FAQ here.

Changelog

You can read the whole changelog on the project page.

Download

Download
Download latest version of WordPress.com Popular Posts
for WordPress 2.8+

or v1.3.5 for WordPress < 2.8

License

WordPress.com Popular Posts is released under a GPL v3 license.

This plugin required many hours of development. If you like this plugin, then buy me a coffee!

541 risposte su “WordPress.com Popular Posts”

Ciao Frasten!

I installed your plugin and really loving it so far. It works like a charm, nothing to complain about πŸ™‚ However, I’ve a litlle request for help. I’m trying to exclude 3 pages, but can’t make it work. As a matter of fact, I cannot make it work even excluding 1 page, it gets the full list anyway. The code I’m using is as follows:

[CODE]<?php WPPP_show_popular_posts( "title=&number=5&days=14&exclude=3&format=%post_title%” );?>[/CODE]

and I also tried this, comma separated (also tried enclosing everything on ” and parenthesis, but it doesn’t work)
[CODE]<?php WPPP_show_popular_posts( "title=&number=5&days=14&exclude=3,5,36&format=%post_title%” );?> [/CODE]

what am I doing wrong?

Many thanx in advance, and many thanx for this great plugin! (Y)

Mitico plugin!

Now in English so everyone can benefit….

1) I’m using the plugin right from the code, with no widget. It takes quite a bit to load data, but as for the Dashboard , I believe it depends on WordPress.com stats servers…However ,I was thinking if it’s possible to enclose the function call to the plugin in a iframe to let the rendering of the page, run in the meanwhile.

2) The output of the plugin is done in a way it looks uncompatible with other plugins, say qTranslate that requires the following syntax when outputting data, like this

//So if you have something like this
do_someoutput("Code");
// replace it with
do_someoutput(__("Code"));

As I’m using the version of your plugin for older Wp installs, I believe it will not be modified, ever… so I was thinking to adapt the code… where should I replace the code to meet the example above?

Thanks for helping

Ciao!

Ok I did the dirty work for you! πŸ˜›

In wppp.php (1.3.5), line 152, change to:

$p[‘post_title’] = __($updated_p->post_title);

(There are 2 underscore plus () to enclose the variable; this will allow qTranslate to work!)

Awaiting for your comments particullarly on the iframe solution/speed enhancement…

Evvai!

I’m working on the idea to defer content load of top posts… instead of the iFrame, I’m using jQuery to load top posts in asynchronous mode…

I have most (if not all) of my posts sitting in child categories. Is it possible that this is causing an issue when adding %post_category% to the format value in a widget?

R

Hi,

Re my previous question about the with %post_category% in format. The reason for the array error is that wppp.php uses the get_the_category function to retrieve the category name(s) which returns an array with all the posts’s categories.

Fair enough.

I did make a change to wppp.php to retrieve and display the 1st category in the list. Works for me.

If you ever want to do this – change (line 230) in wppp.php from:

` // %post_category% stuff
if ( strpos( $instance[‘format’], ‘%post_category%’ ) ) {
$replace[‘%post_category%’] = get_the_category( $post[‘post_id’] );
}`

to this…

‘ // %post_category% stuff
if ( strpos( $instance[‘format’], ‘%post_category%’ ) ) {
// RS account for multiple categories
$single_cat = get_the_category( $post[‘post_id’] );
$replace[‘%post_category%’] = $single_cat[0]->cat_name;
}’

I have no idea whether my effort is good or bad coding – but so far it has allowed me to do what I needed to do.

To the author… perhaps a suggestion for a fix?

Cheers,

R

I’ve finally made to load the top posts using Ajax.
The page loads immediately, while the top posts box loads asynchronously.
Very good!
Not sure if the spiders indexing the web site will like that single element delay (up to 28 seconds)

@all: I was on holiday, let me answer to all of you!

@Rob Scott: at this moment, this plugin can’t do that. But I’ve already that feature in my to-do-list, I’ll implement it when I have some spare time.

@Mugur: the plugin should already provide a bulleted/numbered list, depending on your preferences. If it doesn’t work for you, let me know.

@edd: other users reported this issue, but I think that that’s something wrong at wordpress.com’s side, in the data they provide.

@Coco: your code is ok, I must investigate. Could you please follow these instructions and mail me the debug log?

@Aditya, @Tiger33: thank you! πŸ™‚

@Blutarsky: 1) the load time should really get improved when I’ll implement a cache system.
Meanwhile, if you want to put it inside an iframe, I think you could include wp-config.php via:

require_once("the/path/to/wp-config.php");

and then put the WPPP_show_popular_posts() function inside it. But I haven’t tested it, let me know if it works for you.
2) many thanks for the patch, I’ve just
committed it into the trunk. You’ll see it in action in the next version. (I have also backported your patch to v1.3.5)
3) about jquery deferred loading: it will be almost unuseful when I’ll implement the cache: it will take only some microsecond to load the list πŸ™‚ However 28 seconds is REALLY bad!!! I think something’s wrong with it :-/ Maybe I’ll ask you a debug log when I’ve some free time..

@Robert: Thank you for reporting and fixing this bug. Probabily I didn’t test it enough (I don’t use categories), sorry, it was my fault. I’ve just committed your patch into the trunk.

@Isaac | GoBlogger: it should be trivial to implement. Added to the wishlist.

Welcome back… (“..e anche ‘ste vacanze ce le siamo tolte da….”

I got the dude working with jQuery, I didn’t know javscript needs to be initialized, but I had to load wp-load.php; working fine after that, but as I’ve said very slow.

I believe it’s a wordpress.com stats plugin problem. I see also in the dashboard looking the stats is very slow.

Caching data would be fine!