WordPress plugin: WP Posts Filter

Читать эту страницу на русском языке / Read this page in Russian.

This plugin filters posts by tags and/or categories. It allows to filter posts for the main page as well as for a particular page. You can set up a filter for any page but it’ll work only if you’ve placed the shortcode at that page. There is also the possibility to turn off the filter for a particular page not losing the page's filter settings.

You can download this plugin here. Read more about this plugin below.

The plugin filters posts by three ways:

  1. Category,
  2. Tag,
  3. both Category and Tag.

Few notes about the plugin's behavior

  • the plugin outputs post if and only if the post has at least one category that is marked in plugin's settings page,
  • the plugin outputs post if and only if the post contains at least one tag that is marked in plugin's settings page,
  • the plugin outputs post «by category and tag» if and only if the post has the category and the tag that are marked in plugin's settings page.

You can set the number of posts per page for a particular page. By default, «Posts per page» (Settings -> Reading) option is used.


You need to place the shortcode to make the filter work at the particular page. With that shortcode you can also setup some options.
Here is how it looks by default:


This way, the plugin filters posts using it's default settings or settings defined in plugin's settings page. Here is the full writing of the shortcode:

[wppf heading_tag=”h2” heading_class=”entry-title” content_tag=”div” content_class=”entry-content” per_page=”10”]

There is no necessity to write all the parameters in the shortcode.

Parameters definition:

  • heading_tag — html tag for the post title. h2 by default,
  • heading_class — css style for the post title. entry-title by default,
  • content_tag — html tag for the post excerpt. div by default,
  • content_class — css style for the post excerpt. entry-content by default,
  • per_page — number of items per page. Settings -> Reading «Posts per page» or 10 by default.

Feel free to comment, suggest etc. You can also start a discussion topic about the plugin here. Feel free to use issue tracker if you find bugs or want new features to be implemented. If you want to translate this plugin to your language, you can take wp-posts-filter.pot file (located in the root directory of the plugin) as the basis for translation. Contact me if you want your translation to be included into the plugin.

51 комментариев

  1. Steve
    Опубликован 19 марта 2012 в 19:17 | Прямая ссылка


    Whenever I turn on the Plugin, it makes the Navigation from my brandnav disapear.

    If you have any Ideas on how to fix this, please write me, since ur plug-in is EXACTLY what I need.

    Spaciba, baka, Istvan

    PS: Please dont reply in Russian, cause I can't really speak it.

  2. Steve
    Опубликован 20 марта 2012 в 11:47 | Прямая ссылка


    I checked the install aigain. The problem is within the Pagelines Framework.

    I'm using Pagelines Framework, which adds a new type of menu you can use (brandnav). If I use the standard (Branding + Navigation) your plugin works correctly. But when I use the brandnav (navigation) it just doesn`t display it on the Blogpage. So the problem is with Pagelines, not being compatible with your plugin.

    So, I can work around it, not using the brandnav and instead styling (css) the branding and navigation to make it look the same (like brandnav). But if you want to give your Plugin more compatibility, then here is the html which differs when using brandnav instead of branding and navigation:


    It would be awesome if u supported this aswell.

    I'm using no plugins, for now, so there is no point in a scr. I'm using the 3.3.1 version (latest) with the new type of menu.

    Hope I could help u help me and in making the plugin even greater then it already is.

    Thanx, Istvan

  3. Brett
    Опубликован 27 марта 2012 в 5:09 | Прямая ссылка

    I do not know all options available to use in your plugin. I want to display certain Category Posts on a page. I am trying the following code but it is not working:

    [wppf heading_tag=”h2” heading_class=”entry-title” content_tag=”div” content_class=”category” category_class="23" per_page=”10”]

    • Опубликован 27 марта 2012 в 8:36 | Прямая ссылка


      You need to set up the filter for your page in the plugin's settings page (Settings->WP Posts Filter). All filters are turned off by default.

  4. walter
    Опубликован 13 апреля 2012 в 17:05 | Прямая ссылка

    i have the same problem that steve, can you help me?


    great job, the plugin is very simple but work very good!!! (except with the menu :()

    • Опубликован 18 апреля 2012 в 12:27 | Прямая ссылка

      I've contacted with one of Pagelines developers, he tested my plugin with Pagelines and found that the menu works good on his installation. Anyway, I'll try to find a solution to this problem to help you and Steve. Could you send me more info about your WP installation (you can either post it here or mail it to me)?

  5. Alyce
    Опубликован 8 мая 2012 в 12:05 | Прямая ссылка


    Thanks for the plugin it is extremely helpful... Exactly what I was looking for!

    I am trying to put some static text about the posts on some pages of my website, is it possible to do this?


    • Опубликован 8 мая 2012 в 13:55 | Прямая ссылка

      Hi Alyce,

      glad to know it was helpful.

      Currently, you can put any text on a page with [wppf]shortcode and it'll be shown under the posts on that page. This is because of the WP Shortcode API (which was used for the shortcode). I'm trying to find a workaround for this feature now, and if I do, it'll be included in the next version of the plugin.

    • Опубликован 16 мая 2012 в 15:32 | Прямая ссылка

      Hi again Alyce,

      I've updated WP Posts Filter. With version 0.2 you can put selected posts anywhere on the page. SInce it has changed own behavior, you probably need to place shortcodes in new places on your pages.

  6. Matt
    Опубликован 17 мая 2012 в 2:22 | Прямая ссылка


    I installed v 0.2 of the plug-in and it works very well indeed. Now it does exactly what I want, placing static text on the page exactly where I want it and how I style it, with the filtered posts following.

    Very good work. Congratulations and thank you!

  7. Erika
    Опубликован 15 июня 2012 в 3:06 | Прямая ссылка


    I am alittle confused as to where I should place the shortcode. I turned on the filters through the setting but I am not sure what else I should do to get the plugin to work

    Thank You

    • Опубликован 15 июня 2012 в 8:22 | Прямая ссылка

      Hello Erika,

      say, you have a page named «sample page». To make a filter work, you should set up and turn it on for that page («sample page») in the plugin settings page. After that, you need to edit «sample page» and place a shortcode wherever you want in that page. Then save the page. You can now go to your «sample page» and see what filter displays.

  8. Mateusz
    Опубликован 31 августа 2012 в 0:18 | Прямая ссылка

    I have the same problem as Steve. My menu disappears if I turn on the plugin. If there is a solution I would be grateful for your help

    • Опубликован 31 августа 2012 в 10:31 | Прямая ссылка

      Hi Mateusz, I haven't got an answer from Steve regarding his problem anymore since I sent him Simon's (Pagelines developer) message. Here it is:

      > Ive installed your plugin with PageLines Framework.

      > Here is a screenshot of you plugin working with brandnav on the page.

      > screencast.com/t/d4yHwfla

      > As you can see both are displayed fine.

      Since that, I'm asking you to give me a list of plugins you're using in your WP installation. You can send the list directly to my e-mail. I also need to know a version number of your WP installation.

  9. Опубликован 27 сентября 2012 в 21:28 | Прямая ссылка

    Im developing a site, and the plug-in very much serves a need. However, when the post is picked up, the plug-in seems to strip out all of the HTML formatting from the post [h3, p, strong, em, linebreaks, etc ]whtn the post is displayed on the page.




    Any thoughts?

    I'll need to have this working before I hand over the «keys» to the client to make their own posts & edits. Using WP 3.4.2 with a customized PicoLight theme.

    • Опубликован 28 сентября 2012 в 10:58 | Прямая ссылка

      Hi Kurt,

      seems like you have your ul-tag wrapped with the code-tag. That's why you have all formatting stripped out. Since my plug-in doesn't generate any html-code containing the code-tag by himself, I would suggest you to check your plug-in settings and the page template. For plug-in settings, it could be the tags and styles settings, either global or the page ones.

  10. Опубликован 28 сентября 2012 в 22:44 | Прямая ссылка

    Thank you Oleg! Figured it out with that hint.

  11. Markos
    Опубликован 22 ноября 2012 в 8:25 | Прямая ссылка

    Hello, how can I show the featured image in a filtered post list? Currently I only get the heading and text.


  12. Ross
    Опубликован 10 декабря 2012 в 19:57 | Прямая ссылка

    Hi Oleg,

    Love this plugin — it's saved me on a couple of projects where I couldn't get the categories to show on separate pages for various reasons.

    Just got one question — is there a way to show the post date? I'd really like to be able to show the date of a post for a specific category...

    Hope you can help!



    • Опубликован 12 декабря 2012 в 15:15 | Прямая ссылка

      Hi Ross,

      glad you find the plugin helpful!

      Currently, there is no such a feature in the plugin. The only thing you can do here is change the code of the plugin so that it could be able to display dates. I've added your question as a feature request, so I suppose I'll implement this feature.



      • Ross
        Опубликован 12 декабря 2012 в 15:32 | Прямая ссылка

        Hi Oleg,

        Thanks for your response!

        No rush — it would just be a nice feature to add! 🙂

        Could you tell me where I could add it in the plugin code so I could add it myself?



        • Опубликован 16 декабря 2012 в 22:05 | Прямая ссылка

          Hi Ross,

          sorry for late answer, wasn't able to reply.

          You can modify the wp-posts-filter.php, method called wppf_shortcode () . This method is resposible for displaying the list of posts on any page but the home one. Find the foreach () loop (lines 378 — 388). This is the place where html-code is generated and filled with posts. Here you can add your html-code and fill it with anything you need. I'd use get_the_date () for date. If you need to do the trick with the home page, you'll need to modify it's template file located in your theme directory.



  13. Ross
    Опубликован 8 января 2013 в 0:27 | Прямая ссылка

    Hi Oleg,

    Still loving the plugin, but I have another question! Sorry!

    At the moment, I'm only able to display excerpts on each page. I want to set it up so that I can show the full post on the NEWS page, but still just the excerpts on the other pages I'm using the plugin.

    Is there a way to do this, or do you know of a plugin I can use in conjunction with yours to make this happen? I know I could edit the plugin source to display the_content on all pages, but is there a way to do it just for one category?

    Would really appreciate it if you could let me know how to work around this!

    Thank you,


    • Опубликован 9 января 2013 в 16:56 | Прямая ссылка

      Hi Ross,

      No worries, ask and I'll try to help 😉

      For your question, I'd use categories functionality: add the News category for all posts that are representing news and use the URL for the category as a starting point for users (like this olezhek.net/category/linux). WP will then use it's template functionality (codex.wordpress.org/Category_Templates). You will probably need to customize a template file for this, e.g. category-news.php for News category or category.php for all categories you have.

  14. Ross
    Опубликован 8 января 2013 в 15:25 | Прямая ссылка

    Sorry Oleg — another query. I've tried to include the date like you mentioned above.. and I've used the following code, but nothing shows up:

    Do you think you'd be able to help me via email on this one? My client would now like the date to show up on the posts and I can't get it to show!



    • Опубликован 9 января 2013 в 17:22 | Прямая ссылка

      Here is what is in the plugin (wp-posts-filter.php:378-388):

      foreach ( $filtered_posts->posts as $post ) {
                                      setup_postdata( $post );
                                      $result .= "<{$heading_tag} class='{$heading_class}'>
                          <a href='"
      . get_permalink( ) . "' title='{$post->post_title}'>
                      <{$content_tag} class='{$content_class}'>"
                                      $result .= get_the_excerpt( );
                                      $result .= "</{$content_tag}>" . PHP_EOL;

      What we need is to add the date. We'll use get_the_date () for this. Let's suppose we need to add the post date in the beginning of the post title, so it'll become looking like "2012-12-31: New year's eve! ". To get this working, you need to add get_the_date () call so that the code I posted above will be looking like this:

      foreach ( $filtered_posts->posts as $post ) {
                                      setup_postdata( $post );
                                      $result .= "<{$heading_tag} class='{$heading_class}'>
                          <a href='"
      . get_permalink( ) . "' title='{$post->post_title}'>
      . get_the_date('Y-m-d') . ":
                      <{$content_tag} class='{$content_class}'>"
                                      $result .= get_the_excerpt( );
                                      $result .= "</{$content_tag}>" . PHP_EOL;

      (find the line inside the -tag). Replace the code from 378-388 with the resulting code from this comment and try. You'll probably need to clean up the copy-paste as sometimes it copies the incorrect symbols for quotes for example.

  15. Ross
    Опубликован 9 января 2013 в 18:14 | Прямая ссылка

    Hi Oleg,

    Thank you so much for your help! I've now got the date showing, thanks to your instructions!

    However, I'm still not quite understanding the categories. Would I be able to email you or IM you on Skype (I'm rossautomatica on there) to try and get this set up? I would also like to donate something to you via Paypal as a thank you for your time.



  16. Опубликован 9 января 2013 в 20:48 | Прямая ссылка

    Hi Oleg

    I have issue with the setting page of this plugin. The toggle in page setting is not working. I have tried to deactivate all plug-in but it does not work. I use both chrome and firefox broswer

    WordPress 3.5 Plugin version 2.0

    List of plugins:


    Hello Dolly



    WP Posts Filters

    Link blog.washingtonpacificgroup.com


  17. Опубликован 7 февраля 2013 в 0:19 | Прямая ссылка

    This was working perfectly for me. Now, however, when I try to go to our blog page (www.commetrex.com/blog/; all the posts on this page are filtered by your plugin using the category «blog»), this is what I get:

    Danger: Malware Ahead!

    Google Chrome has blocked access to this page on www.commetrex.com. Content from cilfl.org, a known malware distributor, has been inserted into this web page. Visiting this page now is very likely to infect your computer with malware. Malware is malicious software that causes things like identity theft, financial loss, and permanent file deletion.

    • Опубликован 7 февраля 2013 в 0:23 | Прямая ссылка

      Update: I've removed the filter shortcode from the page, but I still get the malware warning.

      • Опубликован 7 февраля 2013 в 12:10 | Прямая ссылка

        It means that the problem you have is not connected to the plugin functionality. Anyway, I checked the blog and the main page of your website and haven't found any includes for my plugin (screenshot attached for the blog page). Also, I found that you had a js include before the doctype definition on your blog page (screenshot). It either the developer mistake or (most likely) the website is hacked. These includes can appear because of trojan on the computer having ftp/sftp passwords saved inside ftp/sftp-client application. Regarding the plugin, the only javascript it includes in the web pages is the toggle disable/enable functionality in the plugin settings page. If you're not sure about it, you can observe the source code for the plugin

  18. Опубликован 9 августа 2013 в 22:21 | Прямая ссылка

    I have everything working well, except when I go to the page it have the posts in a box with the scrolling bars? How do I fix this?



    • Опубликован 12 августа 2013 в 19:28 | Прямая ссылка


      you've probably setup your style-sheet to enable scrollbar for an element containing the plugin output.

      • Опубликован 23 августа 2013 в 2:49 | Прямая ссылка

        I've tried to find where I can change this, but I'm not having any luck. I made the page and put the code exactly as you state to do so. So on there it says nothing about a scrollbar. I looked in my style-sheet and I'm not sure where I would need to change the code to fix this?

  19. Tom
    Опубликован 17 августа 2013 в 2:41 | Прямая ссылка

    Hi, I have been very happy with your plugin, but recently it has stopped working on our homepage. When I click on the “next page” link at the lower right of the home page, it doesn’t actually go to the next page of blog posts. Do you know why this might be happening? No WordPress / system changes took place as far as I know. Thank you for yoyur time.

    • Опубликован 17 августа 2013 в 10:53 | Прямая ссылка

      Hi, it's the blog engine that does the pagination in case if you set up it to display recent posts on the homepage, not the static page. So, if there were no plugin/engine/php/dbms updates or db changes at all before the pagination's been broken, I doubt I have an answer. If you set up your blog to display some static page as the homepage, and enable a filter to display some posts on that page, it's the plugin that does the pagination. I'd expect some plugin settings have been broken in that case. Or, for both cases, it might be that the plugin code's been changed by someone. If I were in your shoes, I'd try to disable the plugin and check if the blog started working as it should. Reinstalling the plugin would help in case the database or plugin scripts were changed. Before making any actions, I'd check if the system and the blog engine and it's plugins (especially pagination ones) have been updated.

      Please let me know the update on your question so I could be able to help you out

      • Tom
        Опубликован 21 августа 2013 в 1:25 | Прямая ссылка

        Thank you for the prompt response. Yes the plugin is doing the pagination (as the homepage is actually a static page I created, which lists posts based on category — and not the default WordPress homepage). I don't think the plugin is completely broken — because it works on another page in the site.

        connection.sagepub.com (pagination doesn't work here)

        connection.sagepub.com/insight/ (pagination works here)

        I updated WordPress and two other plugins, but this did not fix the situation.

        Any ideas? I am stumped.

        • Tom
          Опубликован 21 августа 2013 в 1:42 | Прямая ссылка

          I forgot to mention that I uninstalled the plugin and its files from the dashboard, then reinstalled and set up the plugin again... and I still have the same issue.

  20. Опубликован 27 октября 2013 в 1:52 | Прямая ссылка

    Hi, i have a question regarding the plugin, here is my website page that filters posts with the plugin: www.arinternacional.com.ar/blog/eventos/

    is there a way to have separators or divisions between the posts? like an horizontal line or maybe even some space between them.

    Thank you so much!

    • Опубликован 5 ноября 2013 в 17:57 | Прямая ссылка

      Hi Lisandro,

      If you're using the latest version of the plugin, 0.3, this can easily be done by altering either the default template or creating the new one. Please refer to the README file for details on how to do that, as I still need to update plugin info page here on the blog 🙂 



  21. Sheela
    Опубликован 21 ноября 2013 в 0:00 | Прямая ссылка

    Hi Oleg,

    I'm trying to use your plugin for the first time and am having the problem where it causes my primary navigation to disappear from only the Home page. It is present on the other pages. The Home page is all most recent posts. The navigation does not contain any categories — it is all links to other pages outside the WordPress posts & pages.

    I can't figure out how to get the navigation back into the page. I've deactivated all other plug-ins but that doesn't not help. If I comment this line, it gives back the navigation but of course it does not filter the category any longer:

    $filter_by = isset ($wppf_opts['frontpage']['filterby']) ? $wppf_opts['frontpage'] ['filterby']: 'none';

    thank you for any help you may be able to give. If I get this working, your plug in is by far the best I have found for filtering categories. Very good plug-in.

    • Опубликован 24 ноября 2013 в 23:35 | Прямая ссылка

      Hi Sheela,

      I think it might be related to the theme you're using. What happens when WP is about to get posts is that WP Posts Filter applies the condition set up in the plugin admin page to that generic WP query. After that, WP executes the query, gets the data from the db, formats things and so on... So here, I think, might be the case when the theme you're using (or a menu plugin) does the same as my plugin does. Thus, the query gets broken and you get nothing. The quick fix for that could be to setup WP to display some static page not the recent posts. Then, you need to go to my plugin settings page and setup a filter for the page you defined as a main page of your blog. After that, you need to edit the page by putting a shortcode into it. Then Save and try it.

      If you'd like fix that anyway, then I'd ask you what theme and what plugins you're using. If there's an incomaptibility and I can fix it in my plugin, then it's better me to do that. Otherwise, a plugin/theme developer's participation is needed.

      Please let me know the update on your question.



      • Опубликован 3 декабря 2013 в 1:35 | Прямая ссылка

        Hi Oleg, thank you very much for your answer. I tried 2 additional themes and the navigation disappears on both of them. If I deactivate the wp-posts filter plug-in, they are again visible. One thing about my navigation all the items are links that are outside of the blog, so are not actually linked to any of the blog posts. I have deactivated all other plugins, so yours is the only one active. I tried different themes, one is named Houston by Woothemes. It gives the option to use links for the primary menu. Thank you for any help you can give.

Оставить комментарий

Ваш e-mail никогда не будет опубликован или передан третьим лицам. Обязательные поля отмечены *