BNS Featured Category
Plugin with multi-widget functionality that displays most recent posts from specific category or categories (set with user options). Also includes user options to display: Category Description; Author and meta details; comment totals; post categories; post tags; and either full post, excerpt, or your choice of the amount of words (or any combination).
Download
Latest version: Download BNS Featured Category v1.6.2.3 [zip]
Installation
This section describes how to install the plugin and get it working.
- Upload
bns-featured-category.phpto the/wp-content/plugins/directory - Activate through the ‘Plugins’ menu.
- Place the BNS Featured Category widget appropriately in the Appearance | Widgets section of the dashboard.
- Set options to personal preferences:
* Widget Title
* Categories – separated by commas
* Show (first) Category Description (checkbox)
* Show Author and date/time details of post (checkbox)
* Show all categories attached to post (checkbox)
* Show all tags attached to post (checkbox)
* Show post in full or use default of post excerpt (checkbox)
– or -
- Go to ‘Plugins’ menu under your Dashboard
- Click on the ‘Add New’ link
- Search for bns-featured-category
- Install.
- Activate through the ‘Plugins’ menu.
- Place the BNS Featured Category widget appropriately in the Appearance | Widgets section of the dashboard.
- Set options to personal preferences:
* Widget Title
* Categories – separated by commas
* Show (first) Category Description (checkbox)
* Show Author and date/time details of post (checkbox)
* Show all categories attached to post (checkbox)
* Show all tags attached to post (checkbox)
* Show post in full or use default of post excerpt (checkbox)
Reading this article for further assistance: http://wpfirstaid.com/2009/12/plugin-installation/
FAQ
Q. Can I use this in more than one widget area?
A. Yes, this plugin has been made for multi-widget compatibility. Each instance of the widget will display, if wanted, differently than every other instance of the widget.
Q. How can I style the plugin output?
A. The plugin uses several “common” WordPress functions that create standard class and id elements that can be styled in the style.css file
* the classes generated by the post_class() function; and, the id generated by “post-” apended to the_ID() function wrap the general post output
* the plugin class post-details wraps the general meta details of the post, such as the Author, Categories, Tags, etc.
* the overall plugin may also be wrapped in a widget “container” class, or id, specific to the theme itself such as (but not limited to): widget, sidebar, left, right, etc.
With the addition of the display Category Description option an additional class was written into the plugin. To style the category description displayed add the class ‘bnsfc-cat-desc’ to your style.css file then use your choice of properties to style the text, for example:
.bnsfc-cat-desc {font-style: italic;}
Q. Can I increase the maximum posts to display?
A. As of version 1.6.2 the Total Posts to Display is independent of the “posts per page” setting as set under Settings | Reading.
Changelog
1.6.2.3
- compatible with WordPress version 2.9.2
- updated license declaration
1.6.2.2
- clarified the plugin’s release under a GPL license
1.6.2.1
- compatibility check for 2.9.1 completed
1.6.2
- Total Posts to Display can now exceed the posts_per_page option value.
1.6.1
- Minor correction to variable structure to allow for multiple instances of the plugin with independent post counts
1.6
- added option to display the description for the (first) category choice as taken directly from the Categories panel under Posts in the Dashboard
- wrapped Category Description in its own class: ‘bnsfc-cat-desc’
- corrected issue with checkboxes not displaying their state correctly
- Updated the screenshot to show the most recent version of the options panel
1.5.1
- modified excerpt function name to make more unique to plugin
1.5
- added option to set the quantity of the first words of the post to display instead of the default excerpt.
- modified description to reflect new functionality
- slightly increased the size of option panel to better display controls
1.4
- added version control compared against $wp_version
- added horizontal rule to option panel for clarity
1.3
- code cleanup and error trapping
- added dynamic reference of maximum posts based on blog Settings | Reading “posts per page”
1.2
- code clean up
- changed the_content(__(‘Read more …’)) to the_content() as a more “default” version
1.1
- added option for Post Titles only
- added
1.0
- Initial Release.



The field “Total Posts” has a bug? The max number of posts to be displayed is the max number of posts in the page?
@HernĂ£ – Yes, the “Total Posts” currently has a maximum value equal to the total posts to be displayed on a page (as set in the Dashboard under Settings | Reading). Although I would not consider this to be a “bug”.
It is already on my “To Do” list to add a dynamic note on the options panel to reference this quantity (as it is set by each user to their own preference); and, I am also making a note of your idea to expand on this.
Thank You.
Is there any chance this could include thumbnails and an option on the widget page to limit the number of words? It’s almost exactly what I’m looking for, and that would make it perfect!
@Greg – Those are some very interesting ideas. I like them both. They will definitely be on my list of items to review for this plugin.
If it could be configured to work with timthumb and use an existing custom field (with new dimensions), that would be perfect!
@Greg – I will take a look at timthumb as well in the review process. Thanks for this idea, too.
Glad to be listened to
I just have to figure out how to fix the styling. I copied all my .post entries in css and made them .widget .post, but it’s not changing anything.
@Greg – If you could note which specific post as a reference point, I would be more than happy to take a look.
Thanks for the great plugin, I’m going to use it for my new design that isn’t active yet.
Again.. tnx!
[...] BNS Featured Category (version 1.4) [...]
I like add a simple text in widget, but.. Can you help me? Thanks so much, Lucio
@Lucio – What text did you want to add, and where did you want to add it?
I would like to add a field text formatted (free write) before posts for each category. Like a presentation of each category selected.
Thanks for your atention
Lucio
@Lucio – I believe I understand what you are asking for. Making those changes would be some work. Additional options, and a full text box for typing in would need to be added to the layout. It is an interesting idea, but well beyond a simple solution. I will add the idea for review at a later date.
Although it does give me an slightly different idea: add the first featured category’s description, as an option. This may allow you to “free write a presentation” and is more likely to be implemented in an upcoming release.
@Lucio – Have a look at version 1.6 of the plugin. I have added the Category Description display option that I believe will meet your needs.
Hi Edward,
Excuses for my bad english
Thanks for this plugin which almost suits my needs!
Just a little thing: I’m not a “pro” in php, so do you have just a piece a code which can let me have more posts in your plugin than in my home page???
Explanations: In the second colums of my site, i want to replace the video wall actually in place by a list of “short news”… So i wanted to put them in a single category, and exclude this category from the rest oh home
Maybe a little change in the code would do that, waiting for a new version of your plugin as explained in an other reply in this page?
Thanks in advance;)
Adding code to override the dynamic maximum post count from the Dashboard is still on the to-do list. I will be revisiting the plugin code soon; and, will make a point of looking at this item again. Thank you for the reminder.
Hey again Cais,
I got this error when I tried to upgrade to the current version:
Cannot redeclare load_my_bns_fc_widget() (previously declared in /home/content/44/4799444/html/wp-content/plugins/bns-featured-category/bns-featured-category.php:22) in /home/content/44/4799444/html/wp-content/plugins/bns-featured-category/bns-featured-category.php on line 23
Got it with both the category and the tag plug-in.
@Paige – First thing to try is to remove the plugin (delete if necessary) then re-install it. I have seen this error before, but I also believed I had corrected it. Let me know … Thanks.
I went to uninstall and it shows version 1.6.2, so I guess it upgraded successfully and randomly generated the error. Thanks for all your hard work!
@Paige – Thanks for the update! I appreciate your time letting me know of the issue you experienced.
Thanks so much
Lucio
Great plugin and thanks for all the effort. Would be nice if we could have template tags.
@finid – Thank you! What did you have in mind for “template tags”?
Basically, tags that could be used to embed the output of the plugin in non-widgetized parts of a theme.
@finid – Ah, yes, that is what I suspected. At the moment it can be done using the_widget() function. This is from “trunk”:
the_widget (line 1291) Output an arbitrary widget as a template tag * since: 2.8 void the_widget (string $widget, [array $instance = array()], [array $args = array()]) * string $widget: the widget's PHP class name (see default-widgets.php) * array $instance: the widget's instance settings * array $args: the widget's sidebar argsLet me know if you need help with the specific parameters. I have not found documentation for this function beyond what is in ../wp-includes/widgets.php, yet.
@finid – Here is some working “clean” default code you can start with:
<?php the_widget( 'BNS_Featured_Category_Widget', $instance = array( 'title' => 'Featured Category', 'cat_choice' => '1', 'count' => '0', /* resets count to zero as default */ 'show_count' => '3', 'show_meta' => false, 'show_comments' => false, 'show_cats' => false, 'show_cat_desc' => false, 'show_tags' => false, 'only_titles' => false, 'show_full' => false, 'excerpt_length' => '' ), $args = array ( 'before_widget' => '', 'before_title' => '', 'after_title' => '', 'after_widget' => '' ) ); ?>thnx for such a wonderful plugin,do have any plans on including the thumbnails function?
That would be awesome.
@shoaib – Thanks for the compliments! Adding post thumbnails is still on the review list, especially with the new functionality added in WordPress 2.9
This plugin works fine for me, but I still don’t understand how to edit the CSS for this… I tried using
.bnsfc-cat-desc {font-style: italic;}as a test, but nothing changes. I just want to tighten up the spacing between the UL of each post and to have a solid line under each one. (Default is a dotted line?)
Hmm…
@Scott – The basic styling of the items in the widget follows from the styles that would be used by your archive/category template page. I added additional CSS classes so you could modify the widget output to look differently if you wish.
Looking at your website using your “Comix” as a sample, try this bit of CSS in your style.css file:
.bns-featured-category .post {margin: 0 0 10px;}The CSS you tried above would only affect the Category Description which does not appear to be in use with the Comix example.
That did it! Perfect!! Thank you so much for making this, btw!
That’s great! … and you are welcome.
Is there any way to apply different style classes to the category headings based on the category ID or name? It seems that they’re just using the widget-header class, but I need to make each category heading look slightly different.
Thanks, by the way, for your work on this plugin.
@Eric – A quick look at what you are suggesting would indicate that a single category class identifier could easily be added to the code, but the plugin functionality allows for multiple categories in the same instance.
In this case, I will be investigating the multiple category modification idea further before releasing additional code. Thank you for the idea!
If you point me in the right direction in the plugin code, I might be able to contribute a patch that does it. We need something like this ASAP for a specific project, so I’m motivated to make it happen
If you are looking at “re-styling” the title, then you will need to work with the code on line 93.
Modify by adding a wrapping ‘div’ around the ‘$title’ variable … without testing, this may work:
NB: Expect this to break (badly) if more than one category is used in the instance.