Este plugin não foi testado com as 3 últimas grandes versões do WordPress. Pode já não ser suportado e pode ter problemas de compatibilidade quando usado com versões mais recentes do WordPress. Popular Posts


IMPORTANT: 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. Popular Posts lists the most popular posts on a WordPress powered site.
This list can be used in the sidebar to show an indication of which are the most visited pages.

For further info visit plugin homepage.

Requires one of these plugins installed:

From v2.0.0, it requires WordPress 2.8 or greater.


  • Catch your visitors’ eye with a list of your most interesting contents!
  • It doesn’t overload your site: all the stats are stored on
  • Support for multiple (and different) widgets on a page
  • Support for shortcodes to embed the list inside a page/post
  • Choose how many links to show, the time period of the stats…
  • Support for filters: by category, ID, authors, visits…
  • The format of the link is completely customizable
  • Support for displaying post thumbnails in the list
  • Support for displaying post excerpt
  • Support for displaying post visits
  • Internal caching system, to be faster than light

You can follow the development on Github.

Instalação Popular Posts can be installed easily:

  1. Download and install Jetpack
    or Stats plugin.
  2. Download Popular Posts .zip archive
  3. Extract the files in the .zip archive, and upload them (including subfolders) to your /wp-content/plugins/ directory.
  4. Activate the plugin through the ‘Plugins’ menu in WordPress
  5. Inside the WordPress admin, go to Design > Widgets, and add the ‘Popular Posts’ widget where you want, then save the changes.
  6. If you want, you can customize some settings for the widget, in that page.

Perguntas frequentes

I added the widget, but nothing shows up

Check whether the Stats or Jetpack plugins are installed
and active.
If you use WP Stats, you need at least version 1.2.

I chose to show 5 posts, but I only see 2/3…

Try to raise the value of the Magic Number (under the widget options):
it will try to fetch more data from the server and should fix your issue.
Too bad, this could slow down the plugin, so it would be better to enable
the cache (in the options again).

I’d like to display the most popular posts per category.

Add some WPPP widgets, and then choose a different category in each one’s

How can I integrate this plugin in my non-widget-ready theme?

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 (can be: both, posts, pages; default both)
  • format (the format of the links shown, default: <a href='%post_permalink%' title='%post_title%'>%post_title%</a>)
  • time_format (the format used with %post_time%, see Formatting Date and Time )
  • thumbnail_size (the width/height in pixels of the post’s thumbnail image)
  • 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 following FAQ for instructions)
  • exclude_author (the list of authors IDs to exclude, separated by commas)
  • 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 FAQ below for info. Default 0, i.e. all categories)
  • cachename it is used to enable the cache. Please see the FAQ below.
  • cache_only_when_visitor (if enabled, it doesn’t serve a cached version of the popular posts to the users logged in, default 0)
  • magic_number (set it to a number greater than 1 if you see less links than expected)

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>" );?>

You don’t have to fill every field, you can insert only the values you
want to change from default values.

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 with excerpt_length.
  • %post_thumbnail the thumbnail image of the post
  • %post_category% the category of the post
  • %post_comments% the number of comments a post has
  • %post_time% the date/time of the post. You can set the format with time_format.
  • %post_author% the author of the post.
I want to show the list in a dedicated page/post!

Just add a shortcode like the one below, in your page/post:


Of course you can customize the list, following the instructions in the
previous question. Just add your customizations after wp_popular_posts,
each one separed by a space.

An example:

[wp_popular_posts title='' number=10 list_tag=ol format='<a href="%post_permalink%" title="%post_title_attribute%">%post_title%</a> (%post_views% views)<p>%post_excerpt%</p>' excerpt_length=200 cachename=popular-posts-page]

This example displays a nice top 10 list, complete with title, number of
views, excerpt, and it’s cached for performance.

If you specify the format parameter, be SURE you paste this into the
WP page in HTML or the editor will screw up the HTML formatting in the format= parameter.

How can I enable the thumbnail feature?

You must add %post_thumbnail% to your format field, in the widget’s settings.
For example, you could use this format:

You can customize the image size in the settings.

Note that your theme should support Post Thumbnails, and your posts should
have an image set. If they don’t, a default image will be displayed.
You can read a guide to set the posts’ thumbnail

However you can do this automatically for you, please read the other FAQs

Also note that probably the image will not look nice by default, please see

I added %post_thumbnail% in the format, but I don’t see any image.

The thumbnail function is only compatible with WordPress 2.9+, please check
your WP version. Furthermore, try to disable and re-enable the widget’s cache
in its options.

I added %post_thumbnail% in the format, the image are displayed but I don’t like their style!

This is very theme-dependent, but a good starting point could be adding this
CSS code to your `/wp-content/themes/YOURTHEME/style.css file (note that
creating a Child Theme would be a
nicer choice):

  ul.wppp_list li {
    min-height: 65px;
    display: block;
    list-style: none outside none;

  ul.wppp_list img {
    float: left;
    margin-right: 4px;
    border: 2px solid #ECEFF5;
I didn’t set featured images for old posts. Do I have to set them by hand?

Fortunately not, there are some nice plugins that can set the first image in
the posts as featured image.
One plugin could be: Auto Post Thumbnail.

How can I discover the ID of a post/page?

Log into your admin page, go to Posts or Pages; go with your mouse
on your post’s title, and in your status bar you should see something like
Then 14 is the number you are looking for.

How can I enable the caching system when using WPPP_show_popular_posts()?

When you’re using WPPP_show_popular_posts(), the caching system is not
However you can easily enable it adding a cachename parameter to your
settings string. You will have something like this:

 <?php WPPP_show_popular_posts( "title=&number=3&cachename=topposts1" );?>

where topposts1 is a name you must choose for your list. This allows you
to have different lists with different caches.

I want to change the time format!

Just set the time format as you wish.
For example, if you set the time format to: d/m/Y H:i:s, you will get
something like this: 21/03/2008 22:52:36.
See Formatting Date and Time
for further help.

I have some other issues. How can I get a debug log?
  1. Download this zip file
  2. extract it and overwrite the current /wp-content/plugins/wordpresscom-popular-posts/wppp.php file

Now, if you are using WPPP as a widget:

  1. Log in to your admin page.
  2. Go to Settings -> Popular Posts DEBUG
  3. you’ll see a long text. Copy & mail it to: frasten AATT gmail DOOTT com

If you are instead using WPPP_show_popular_posts() function for non-widget-ready

  1. edit your theme files, replacing your old WPPP_show_popular_posts with WPPP_show_popular_posts_debug .
  2. you’ll see the debug text in place of your usual top-posts list.
  3. Copy & mail it to: frasten AATT gmail DOOTT com

IMPORTANT: Then, for both cases (widget and function) reinstall the
original version of wppp.php.

I want to translate the plugin in my language!

Now you can easily translate the plugin online here:

I’ll add your translations to the plugin!


Este plugin não tem avaliações.

Contribuidores e programadores

“ Popular Posts” é software de código aberto. As seguintes pessoas contribuíram para este plugin:


“ Popular Posts” foi traduzido para 1 locale. Obrigado aos tradutores pelas suas contribuições.

Traduza o “ Popular Posts” para o seu idioma.

Interessado no desenvolvimento?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Registo de alterações


  • New feature: added %post_thumbnail% to show the post thumbnail! Please read
    the FAQ. Thanks to Rocco Agostino.
  • Language: added romanian, thanks to Web Geek Sciense.
  • Language: added vietnamese, thanks to Lê Hoàng Phương.
  • Language: updated catalan, thanks to Ferran Rius.
  • Language: updated italian, thanks to Edoardo Maria Elidoro.
  • Language: updated serbian, thanks to Предраг Љубеновић.
  • Language: updated spanish, thanks to Fitoschido, Fzamudio, Sergio Arriaga,
    hhlp, simon.
  • Language: updated turkish, thanks to Hamit Selahattin Naiboğlu.


  • Fixed a PHP notice.


  • Fixed missing closing tag when there aren’t any popular posts. Thanks
    to sebmeric.
  • Strip HTML tags from the post titles. Please let me know if this
    breaks something for you.


  • New feature: %post_author% tag, to show the post author. Thanks to
    Jean-Paul Horn,
  • New feature: added an option to exclude posts written by some specific
    authors. Thanks to Jean-Paul Horn,
  • Added Serbian translation, thanks to Саша Стефановић.
  • Completed Turkish translation, thanks to Engin BAHADIR and cornetto.
  • Added docs about new Jetpack plugin.


  • Added Catalan translation & updated Spanish translation, thanks to
    Octavi Ripollés i Querol.


  • Added some check to make this plugin more robust with unexpected data.


  • New Feature: added support for [wp_popular_posts] shortcode! Please read
    the FAQ. Thanks to Tim Nicholson for this.
  • New Feature: added ‘none’ option to list tag, to improve customizability.


  • New Feature: added support for subcategories. Now if you set a category,
    it will also show posts inside its subcategories.
  • New feature: %post_time%, it allows to show the date/format.
  • New Feature: added a new Magic Number option. If the plugin shows
    less links than expected, try to raise this number. Please read docs.
  • Added spanish translation. Many thanks to Fabio (Coco).
  • Added (partly) turkish translation. Many thanks to zeugma.
  • Improved compatibility with WordPress 2.9.
  • Fixed an issue in the uninstall process.


  • New Feature: added the new %post_comments% tag in the format to show
    how many comments a post has.
  • New Feature: now you can choose to show the cached version only to the
    anonymous (not logged in) users.
  • Some minor fixes.


  • New Feature: implemented a cache system. This will improve the speed
    of the plugin. If you are using the function WPPP_show_popular_posts()
    for non-widget-ready themes, please read the FAQ.
  • Fixed an issue with %post_category%. Thanks to Isaac | GoBlogger.
  • Better compatibility with plugins like qTranslate. Thanks to Blutarsky
    for this.


  • Regression: you couldn’t set an empty title anymore.
  • Regression: You couldn’t add HTML tags to the widget title.
  • Fix: more robust security checks.


  • New feature: now you can use %post_category% in your format, to show
    the post’s category.
  • New feature: now you can show posts from a specific category.


  • New complete rewrite, using WP 2.8 Widget API. Note: from now on, this
    plugin will require at least WP 2.8
  • New feature: now you can add multiple widgets with their own different
  • New feature: now you can exclude specific posts/pages by IDs.
  • New feature: don’t show posts with a view count under x
  • New feature: now you can choose between unordered (ul tag) or ordered
    (ol tag) list.
  • Fix: now private posts are excluded from the list.
  • Fix: now deleted posts shouldn’t appear anymore.
  • Fix: W3C Validation fix, thanks to Jonathan M. Hollin
  • Fix: fixed an issue with titles containing special characters/quotes.
  • Fix: removed the shortcodes from the excerpt, thanks to Peter.


  • Added a workaround for a cache issue in stats plugin.


  • Hopefully fixed a problem on some blogs, when displaying only posts or
    only pages.


  • Updated compatibility with WP 2.6


  • New option: now you can limit the length of the links.


  • Fixed an incompatibily with PHP < 5.0.


  • Now the titles & permalinks are taken from the database, so they should
    be updated.
  • Arabic/Greek etc. language issues should be fixed now.


  • New feature: Added multilanguage support.
  • Added italian language
  • New feature: now you can show the first n characters of the content
    of each post, through the %post_excerpt% parameter. Just add it to your


  • Added a fix for a bug in WordPress Stats.


  • Fixed some unclosed tags, which caused issues in IE7 configuration of
    the widget.
  • Removed (actually it’s only skipped, not fixed yet) a nasty MySQL error
    if there aren’t any “top posts”.


  • New feature: now you can choose to show only posts, only pages, or both (default).


  • Added CSS class “wppp_list”, so that you can now customize the styling in your stylesheet.


  • New feature: now you can customize the format of the links (see FAQ)
  • New Feature: it’s now possible to show the number of views of the post (see FAQ)
  • Fix: fixed utf-8 encoding issue with WP >= 2.5
  • Fix: now the widget should better integrate with your theme
  • Change: Note: the way to call WPPP_show_popular_posts() to integrate
    the plugin in non-widget-ready themes has changed. See FAQ.


  • Added arguments to the function WPPP_show_popular_posts(). Now you can
    customize several parameters even if your theme doesn’t support widgets.


  • New feature: now you can set the length (in days) of the desired time frame.
  • Fixed a bug with titles containing foreign characters.


  • Added support for non-widgets-ready themes.


  • Fixed a bug with quotes.


  • Added widget configuration.


  • First working release with the widget.