With WP Posts Filter you can display posts of certain categories and tags in a page.
ATTENTION! Please backup your custom templates if you're updating the plugin!
This plugin filters posts by tags and/or categories. It could be set up to filter posts for the main page and/or any other static page of a blog. To set up the filter for a page, one needs to adjust the settings and put a shortcode, a piece of text playing the role of a placeholder for post lists, in the page. Since version 0.3 templates introduced.
You can set the number of posts per page and other preferences either in the plug-in settings page or by placing a customized shortcode tag in a page.
A shortcode needs to be put in a page to make the plugin showing posts in it. You can also setup some additional options using the shortcode. Settings set using the shortcode have higher priority compared to what is set up in the plugin settings page. Here is how shortcode looks by default:
This way, the plugin filters posts using default settings or settings defined in the plugin settings page. Here is the complete writing for the shortcode:
[wppf heading_tag="h2" heading_class="entry-title" content_tag="div" content_class="entry-content" per_page="10" date_format=”F j, Y” post_template=”default”]
heading_tag- html tag for the post title.
heading_class- css style for the post title.
content_tag- html tag for the post excerpt.
content_class- css style for the post excerpt.
per_page- number of items per page. Settings -> Reading "Posts per page" or 10 by default,
date_format- Date format in case if you’re using
#post_date#tag in your template.
post_template- Post template. Should contain the part of a filename, e.g.
The attributes are not required, as you can always set up them in the plugin settings page, though you can always set up them this way either.
Since version 0.3 templates are available. Templating system is applied only to the part of a page containing the plugin output. There are two templates available by default - first one with the default layout (just like it was in the older versions), and the second one with thumbnails display. You can set up what template to use for a page (or for all pages) in the plugin settings page. Please refer to Screenshots section here to find mocks reproducing the way how default templates place post contents in a page.
Templates are php files located in
<plugin-dir>/templates and having filenames like
wppf-item-<some-text-without-dot>.php. To create your own template, name it following the rule described before, put it in
<plugin-dir>/templates folder, and assign a string containing HTML-code to $item_template variable in that file. You can use placeholders to put parts of a post in the places you need. Following placeholders are presented in this version:
#heading_tag#- tag for a post title.
#heading_class#- style for a post title heading tag.
#content_tag#- tag for a post excerpt.
#content_class#- style for a post excerpt content tag.
#date_format#- date format, has the same format as WP Date Format setting and PHP date() function. Refer to PHP date() function for details on how to setup date format. Set it up in the plugin settings page
First four in the list above exist for compatibility reasons.
Following placeholders represent data fetched by the plugin from WP database:
#post_title#- contains post title,
#post_excerpt#- contains post excerpt,
#post_thumbnail#- contains post thumbnail. Contains nothing if a post doesn’t contain a thumbnail,
#permalink#- contains permalink to the post
You can take both templates included as examples for your own template. WARNING! Please consider setting correct file permissions when create a new template file!