This is the second post on Twenty Eleven Post Widgets, the second widget we have added to our child theme is a popular posts widget, this will show our posts based on the number of comments they have received, it may not be a true benchmark of how popular a post is, but it is a way of weighting the posts.
One issue was the difference between a post that has been hanging around for some time, this will have more comments, so we have added a filter for the number of weeks a post has been published.
Popular Post Widget
We have already created a category widget built into a twenty eleven child theme, we have taken this widget and added a few more features, so we can see our popular posts for all or a single category, we have also added the comment count to the output.
The download has all the files required for the child theme, and includes the Category Posts Widget from the previous post, if you have already installed the theme you can just copy the new widget file from the widgets folder (widget-popular-posts.php).
You may download the file here or visit the All Downloads page for other files.Twenty Eleven Popular Posts Widget (458)
After activating the theme there will be a new widget 2011 Category Posts, and 2011 Popular Posts, if we drag this to the sidebar we can add or select different options.
- Title: This can be left blank or we can add a title, we could have made this the Category Name but we thought it would be better to give the administrator the option.
- First Post Display: With the widget we have kept the first post separate, this would be the latest post in the category so we can give it a different output.
- Other Post Display: for the other posts in the category can have a different output, the default is the simple list.
- Category: We do not need to know the ‘Category ID’ as we can just select a category from the dropdown list, leave it blank for all posts.
- Posts from the last weeks: this will default to 0, if we wanted six months then we would change to 26, if we had a lot of posts it could be 2 weeks.
- Number of Posts to Show: this will default to 5 but any number can be entered.
In testing we found the views with images were the most pleasing.
Large image with thumbnails and excerpts
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.
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.