I wanted to create a ‘Newsletter’ page on my WordPress site where I would post a new article every week. The best way to do this was as a Post rather than a separate page each time. However, I did not want the ‘Newsletter’ to appear on the same page as all my other posts and I wanted a separate page to display my ‘Newsletter’ posts. So, being a non-coder I hunted down the appropriate WordPress Plugins to do this job for me.
Exclude Category From Appearing Or Displaying On The Front Page
Firstly, I needed to exclude the category ‘Newsletter’ from showing up with the blog posts on my front page. The plugin that manages this is Front Page Excluded Categories. You do have to duck into the code of the plugin to make one small but very simple change which is explained very well with the plugin instructions.
Open the plugin php file in a text editor and add the category id values you wish to exclude to the $cats_to_exlude string. This is on line 14.
List One Category Posts On A Specific Page
To list the posts from a specific category on a page I installed and activated the List Category Posts plugin. Then with the use of a shortcode I was able to specify what category I wanted to display and what parts of the category to display.
To display the posts from Category ID 11, the full content, and listed alphabetically by the Titles I inserted the following shortcode into a new page I created (remove the space after the ‘[‘ bracket and before ‘]’ bracket. Had to put the spaces here so the code would display):
[ catlist ID=11 content=yes orderby=title order=asc ]
You must have
[ catlist ID=# ]
Replace the # with the ID Number of your category or to make it easier, just use the category name. So for the category called business you would write the shortcode
[ catlist ID=business ]
The other parts of the text in the shortcode I wrote above are other values which determine what and how to display information from your posts. Here are some values below that you can use:
- orderby – use any of these values in the format orderby=author (this would be to order posts by the person that wrote them):
- author– Sort by the numeric author IDs
- category – Sort by the numeric category IDs
- content – Sort by content
- date – Sort by creation date
- ID – Sort by numeric post ID
- menu_order – Sort by the menu order. Only useful with pages
- mime_type – Sort by MIME type. Only useful with attachments
- modified – Sort by last modified date
- name – Sort by stub
- parent – Sort by parent ID
- password – Sort by password
- rand – Randomly sort results
- status – Sort by status
- title – Sort by title
- type – Sort by type. For example:
[ catlist name=mycategory orderby=date ]
- order – How to sort orderby. Use either:
- ASC – Ascending (lowest to highest).
- DESC – Descending (highest to lowest). For example:
[ catlist name=mycategory orderby=title order=asc ]
- catlink – Show the link to the category. Use the template system to customize its display using the variable $cat_link_string. The default is ‘no’; To activate it use catlink=yes.
- numberposts – Number of posts to return. Set to 0 to use the maximum number of posts per page. Set to -1 to remove the limit. The default: 5; To display 10 posts use as numberposts=10]
- date – Display post’s date next to the title. The default is ‘no’; to activate it use date=yes.
- author – Display the post’s author next to the title. The default is ‘no’; to activate it useauthor=yes.
- dateformat – Format of the date output. The default is get_option(‘date_format’)
- template – File name of template from templates directory without extension. Example: For ‘template.php’ value is only ‘template’. Default is ‘default’ that means template in code of plugin not in template file, that’s an unordered list (ul html tag) with a CSS class: ‘lcp_catlist’
- excerpt – Display the post’s excerpt. The default is ‘no’; to activate it use excerpt=yes.
- excludeposts – IDs of posts to exclude from the list. To exclude posts numbered 12, 52 & 37 use excludeposts=12,52,37
- offset – You can displace or pass over one or more initial posts which would normally be collected by your query through the use of the offset parameter.
- content – Show the full content of the post. Default is ‘no’; to activate it use content=yes.
Now you have a page which will display only the posts from a single category, in my case the ‘Newsletter’ category without these posts being displayed on the front page. You can create a whole lot of pages for different topics using this method
Of Course There Is Another Way…
…but this is for people who know a lot more about PHP coding. And that is to create a separate template for the category you are wanting to display posts for in a separate page. It is actually not that hard and a great description on how to do it can be found at moshublog.com. WordPress has a great article in its Codex Directory on Template Heirarchies which will give you an understanding how WordPress works with its templates. You can find this at http://codex.wordpress.org/Template_Hierarchy.