Twenty Eleven Page of Posts Extended

We recently published a post on a WordPress Page of Posts template page for the twenty eleven theme using a child theme, the WordPress page of posts child theme used custom fields to choose a category and a style for the posts, we were asked how to set the number of posts, and how to choose an order by value.

This made the original system a little harder to manage, a lot of custom fields and values to remember, so we got thinking how we could make it easy for the admin to choose values to display the posts, so we have created a new child theme that uses post meta values which is intuitive and easy to manage.

Child Theme

We have wrapped all the code up into a downloadable child theme for the WordPress twenty eleven theme, you can download the theme.

Raindrops 2011 Page of Posts Extended

If we have a look inside the child theme we will see only eight files and one folder, we are not going to go into detail on this post as there is quite a bit of code.

The main meta functions are in the /inc/ folder where there is a file called, pop-meta-functions.php which has over 200 lines of code, this file created the meta-boxes and controls the saving of the values, and will clear the values if the template page is changed.

The page-pop.php file in the main folder is the ‘Page of Posts’ template page, this is the template that we apply when we want a page of posts section on a page, there are also three ‘content-’ page files to display the content.

Lets look at a page of posts template page setup, first we need to create a page, show the Page Attributes, select our Page of Posts template and update, we do not need to have any content in our page it is optional.

After we update the page a new meta box will appear, if we can not see the meta box we select screen options and check page of posts.

We are not going into all the options but we will give a single line and leave you to test and discover the other options.

  • Page Title: if left blank no page title will be displayed, fill it in if required
  • Posts Title: If we have main content we might want a title for our posts block, this could be a tutorial series, random posts, latest, most popular etc:
  • Category: Select a Category for our page of posts, this works only for a single category, you are free to edit the files to use an array, our posts and themes are pointers rather than solutions
  • Sort by: lots of options here, date, last modified, comment count, random, title, etc:
  • Order: Ascending or Descending
  • Post Style: default, Only Titles, Excerpts or Thumbnail and excerpt, this will use the different content template parts in the folder
  • Posts per Page: Defaults to the settings value, but can be different for each page
  • Posts in the Last days: if we are showing latest posts, most popular or have a lot of old posts we can restrict what we see by a number of days, like most popular last 30 days.

Lets test, we add two titles, choose the category of blog, post style of titles only and five posts per page.

This should give us a list of five titles below our page content with a heading, and change the title of our page.

Well that is all we are going to do, now it is over to you, this download is meant to give you a child theme with functional code, this code can be used how you want, the page styling can be changed to suit.

Notices

We do require your feedback to improve our themes and tutorials, please leave your comments good or bad.

Code disclaimer information

If this document contains programming examples, www.DigitalRaindrops.net grants you a nonexclusive copyright license to use all programming code from which you can generate similar functions tailored to your own specific needs.

All sample code is provided by http://DigitalRaindrops.net for learning illustrative purposes only.

These examples have not been thoroughly tested under all conditions. www.DigitalRaindrops.net, therefore, cannot guarantee or imply reliability, serviceability, or function of these examples.

All programs contained herein are provided to you “AS IS” without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.

Membership

Registration and Membership is no longer required for downloading files or interacting with Digital Raindrops, posting a comment or topic in the forum does use Captcha to reduce spammers.

This website is a tool to support and promote WordPress and Artisteer theme development, please support, share and give credit for any benefits you gain from the tutorials on this website.

4 thoughts on “Twenty Eleven Page of Posts Extended

  1. Hey,

    Thanks for the great themes and tutorials.

    I’d like to learn how to combine Child Themes specifically integrate this theme into the Color Theme I have running.

    Should I:
    1) merge Pageofposts’s style.css w/ Color’s style.css & Pageofposts’s functions.php w/ Color’s functions.php using notepad?
    2) and copy the rest of the files from this zip into /themes/raindrops-colormaster?

    Thanks

  2. Pingback: Baby themes and Post Pages! | Zoo La La!

  3. Ecxellent, what I needed. I just have one huge favour to ask. How do I create a 3 or 4 post column with this page template. I need post 1 in col 1, post 2 in col2, post 3 in col 3 ets. Please please help

Leave a Reply

Connections

Connect with Us
Follow Digital Raindrops on Twitter Join Digital Raindrops on Facebook
Share

Related Posts

Posted in Twenty Eleven

pluggable-image2_thumb.png

In April 2011 we wrote a post on pluggable functions, since then we have been looking at other functions like post classes, which we used in the first release of our photo blogging theme. While loitering over on the WordPress … Continue reading

Read More