BNS Featured Category

145

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 v2.1 [zip]

Installation

This section describes how to install the plugin and get it working.

  1. Upload bns-featured-category.php to the /wp-content/plugins/ directory
  2. Activate through the ‘Plugins’ menu.
  3. Place the BNS Featured Category widget appropriately in the Appearance | Widgets section of the dashboard.
  4. 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 -

  1. Go to ‘Plugins’ menu under your Dashboard
  2. Click on the ‘Add New’ link
  3. Search for bns-featured-category
  4. Install.
  5. Activate through the ‘Plugins’ menu.
  6. Place the BNS Featured Category widget appropriately in the Appearance | Widgets section of the dashboard.
  7. 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)

Read this article for further assistance: http://wpfirstaid.com/2009/12/plugin-installation/

Shortcode: bnsfc

Parameters are very similar to the plugin:

  • ‘title’ => ”,
  • ‘cat_choice’ => ’1′
  • ‘use_current’ => false
  • ‘count’ => ’0′
  • ‘show_count’ => ’3′
  • ‘offset’ => ’0′
  • ‘sort_order’ => ‘desc’
  • ‘use_thumbnails’ => true
  • ‘excerpt_thumb’ => ’50′
  • ‘show_meta’ => false
  • ‘show_comments’ => false
  • ‘show_cats’ => false
  • ‘show_cat_desc’ => false
  • ‘show_tags’ => false
  • ‘only_titles’ => false
  • ‘excerpt_length’ => ”

NB: Use the shortcode at your own risk!

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-” appended 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.

As of version 1.9, you may create a custom stylesheet using the name bnsfc-custom-style.css; and save it to the BNS Featured Category plugin folder.
Elements you add into this file will not be overwritten with future plugin updates. 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 bnsfc-custom-style.css file then use your choice of properties to style the text, for example:

.bnsfc-cat-desc {font-style: italic;}

= What style elements are specifically generated by the plugin?

The following CSS elements are generated by the plugin code:

  • .bns-featured-category
  • .bnsfc-link
  • .bnsfc-cat-class-< category choice(s) >
  • .bnsfc-cat-desc
  • .bnsfc-clear
  • .bnsfc-content

Additional style elements may be available but are most likely created through WordPress core functionality, the current active Theme, or another active plugin.

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

2.1

  • Added option to set post sort order – ascending, descending, and random
  • Added ‘no excerpt at all’ checkbox option

2.0

  • Added BNS_Options_Scripts_and_Styles
  • Added inline documentation indicating what conditions will partially collapse the widget options panel
  • Added *-toggle variables for collapse effect
  • Added code to remove spaces (if used) when multiple categories are chosen
  • Added current_theme_supports check for post-thumbnails; no support = no thumbnail options

1.9.3

  • Fixed problem with non-existent custom stylesheet (see 1.9.1)

1.9.2

  • Added ‘offset’ option
  • Add CSS to set background to none; and width to 100% when shortcode used

1.9.1

  • Removed extra slash in wp_enqueue_scripts parameters
  • Added ‘content_thumb’ and ‘show_full’ to shortcode options – back to beta
  • Fixed 404 error when ‘bnsft-custom-style.css’ is not available

1.9

  • released November 2011
  • confirmed compatible with WordPress 3.3
  • added phpDoc Style documentation
  • added i18n support
  • added bnsfc-style.css for plugin specific elements
  • added wp_link_pages after the_content
  • changed code blocks order to more logical sequence
  • changed bnsfc_first_words to bnsfc_custom_excerpt (refactored documentation)
  • changed options panel width to 200px to fit within Administration Panel Sidebar
  • changed bns-cat-class- to bnsfc-cat-class- CSS prefix for category choices for consistency
  • corrected documentation typos
  • fix ‘only_titles’ form issue
  • minor code and format clean-up
  • updated ‘readme.txt’ Frequently Asked Questions
  • updated screenshot image

1.8.5

  • released May 2011
  • confirmed compatible with WordPress version 3.2
  • addressed some minor items in the readme (this file)
  • cleaned up some text strings in the code
  • minor variable changes – load_bnsfc_widget(), bnsfc_custom_excerpt()

1.8.4 / 1.8.4.1

  • released April 2011
  • confirmed compatible with WordPress 3.1.1
  • added option to use current category of post in single view

1.8.3

  • released December 11, 2010
  • Confirm compatible with WordPress 3.1 (beta)
  • Change ‘the_time’ to date-format option
  • Only show number of comments if not password protected

1.8.2

  • released Sept 21, 2010
  • added new and improved shortcode functionality – still may be considered beta

1.8.1

  • removed shortcode function due to error issues

1.8

  • released Sept 19, 2010
  • increased minimum required WordPress version to 2.9
  • add post_thumbnail support
  • added experimental shortcode support – currently best used to generate the only content on a post or page

1.7.2

  • released: 29 Aug 2010
  • compatibility check for WordPress 3.0.1
  • no other modifications

1.7.1

  • released: July 5, 2010
  • cleaned up code to meet WP Standards
  • added wp_reset_query();

1.7

  • compatible with WordPress version 3.0
  • updated license declaration

1.6.3

  • removed the_ID() function as redundant
  • added category related span around widget title

1.6.2.3

  • compatible with WordPress version 2.9.2
  • updated license declaration

1.6.2.2

  • clarified the plugin 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 checkbox not displaying its 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 <div style="overflow-x: auto"> wrapper to allow for images wider than the widget area

1.0

  • Initial Release.

145 Comments

  • Andrew D says:

    Edward thanks for the quick reply. I wanted to figure out what’s happening a little better before I responded again – the thumb size is still not changing for me.
    I played around a bit, and what’s happening is the thumbnail size is coming up as the size set in my Media settings, no matter what I set excerpt_thumb at.
    So if I change my thumbnail size settings (under the Media settings) from 100×100 to 150×150, then upload a new featured image, the thumbnail will show up at the 150 size. Works the same way for reducing the size.
    So… would there be a way for me to have the plugin call the full-size image and reduce the size to a set width, rather than use the thumbnail? This is the only way I can think of to avoid re-uploading all my featured images to change the thumbnail size.
    Again any help is much appreciated.

    • @Andrew – The plugin uses the base function `the_post_thumbnail` and an array to resize the image to the value in the option setting. This is essentially what you are asking for already. The only thing that comes to mind at the moment is the question: does you theme support “post thumbnails” to begin with? Looking over the plugin code again, I see that I do not have a check for this theme functionality that is required for the plugin to work correctly. (NB: It’s going on the TO-DO list.)

  • lynn says:

    I am a true novice at all of this and am building a new site for my business. I love the idea of this plug-in but I can’t figure it out. Soooo this will probably seem like a really stupid question, but the category id that is asked for – is prepopulated as a number (1) for that. Where do I find the category id? I only want two categories to show up under “quick tips” and one under “video library” the categories are Quick Tips – Buyer and Quick Tips – Seller. Video would be the category under the video library tab.

    Thank you for any help you can give this true novice that is much better suited to selling houses! : D

  • vin Ienco says:

    how to get the thumbnail to display ? and the text is all squashed together and goes over the widget footer.

    • @vin – The thumbnail is based on the “Featured Image” of the post, if it is not used then it will not be displayed. As to the text being “squashed together and goes over the widget footer” I cannot say; aside from the meta data being displayed in a particular order based on the code, the balance of the content should be adapting the general styling of the post contents of the Theme you are using.

  • vin Ienco says:

    now its just grabbing posts at random. any fix for that ?

  • HumanV3 says:

    [bnsfc cat_choice='blog' show_count='3'] isn’t working… grabbing from all posts not just the blog. Is there an error with my shortcode?

  • Kevan says:

    Hi Edward,
    Your plugin is great, but I am having a problem using it for my particular situation. I am using a theme that seems to overide the wp posts and cats with its own. So if I attempt to use your plugin, it isn’t able to find the category that I want it to display. Here is an example of the link to a category that I would want to display:
    http://mississippishopsmart.com/handyman-contractor-homerepair/wp-admin/edit-tags.php?action=edit&taxonomy=project_cat&tag_ID=3&post_type=project
    I think that I would want to add into the code something like:
    post_type = ‘project’
    but I am clueless as to where I’d place it???? Any thoughts? Even if it can’t be accomplished thanks for putting a great plugin out there.

  • Adam says:

    Edward, thank you for this plugin. Everything is working as it should except for the [more] tag. It is dead and displaying as (more)…..
    very strange.

    The site with the error is:
    http://lhpmag.com

    Thanks for any help you can provide.

    • @Adam – The (more…) at the end of your excerpts would be derived from your theme and not related to the plugin. Also the plugin uses `the_excerpt`, or the first “X” words from the content (stripped of tags); either way it will not produce a link to the post. This may be something I will look into for future versions. Thank you for the feedback and choosing to use the plugin as extensively as you have.

  • Enrico says:

    Hi Edward, 1.9 version have make some problem with Monalisa plugin (emoticons) and with Sexybookmarks. Looks like some CSS problem, i think, with some align or float (emoticons and sexybookmarks buttons doesn’t align properly, they appears in one column instead the original align).

    • @Enrico – Thank you for the feedback.
      It appears the “wp-monalisa” plugin has issues it should be addressing by this notice upon activation:

      The plugin generated 1194 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

      I would be more than happy to address any conflicts, if they still exist, after the plugin author addresses this message.
      As to the “SexyBookmarks” plugin, I am not seeing any issues using the default settings … can you be more specific or share examples of the issue you are seeing?

  • Enrico says:

    Hi Edward, Monalisa works fine without your plugin, but when your plugin is actived, emoticons lose their alignment. With sexybookmarks you can see the problem here: http://www.freemodding.it/news/cooling-news/noctua-nf-12-pwm-focused-flow.html or at any other article. It isn’t a great issue, just watch the first button (rss).

    • @Enrico – I see the RSS feed button you are referring to as having a CSS issue but I do not see BNS Featured Category as active on that page, nor do I see any potential CSS conflicts in the source code for the page; also to note all CSS elements defined within the plugin stylesheet are specifically prefaced with a unique identifier to insure there are no CSS conflicts with other plugins or the active theme. I am also unable to recreate the issue. I do appreciate the feedback and will leave this item on my review list.

      As to the Monalisa plugin, it may appear to work correctly when my plugin is not installed but I do not review conflicts with plugins that cause the WordPress core to display messages, or warnings, stating there are issues with the plugin in question. Once that is corrected I will be more than happy to review this issue.

  • Enrico says:

    Edward, i think there is some conflict, otherwise i can’t understand why CSS looks fine if i desable your plugin. :) Same issue appears for Monalisa and for Sexybookmarks, so i think can’t be a coincidence.

  • Enrico says:

    Found the problem! The problem seems WP-Minify. For some rason, BNS-Featured Category + WP-Minify makes some conflict with other plugins. If i desable WP-Minify, it looks fine.

  • Cat says:

    Hi, I just installed your plug-in and I’m getting the following error:

    Fatal error: Call to undefined function has_post_thumbnail() in /home/warrick/www/www/wp-content/plugins/bns-featured-category/bns-featured-category.php on line 223

    Any thoughts on what could be causing this? I’ve already tried deactivating other plug-ins to see if they conflict and the same error proceeds.

  • Abe says:

    Hi Ed,

    How do you set the excerpt to 0 ?
    I want to only show TITLE & Post THUMBNAIL without the excerpt.
    Also how to add more space between the post ?

  • Abe says:

    Hi Edward,

    How do you add a line between posts ?
    Also, How do you set the post excerpt to “0″ ?

    Thank you,

  • Fred says:

    Great plugin. I am working on my site (not up yet) and was wondering when I put the BNS featured category on the sidebar so it shows on every post, what code do I change to have it pick random posts throughout the category I have selected so each time a post is loaded the posts in BNS featured category change. Right now it is always the same on every post in the sidebar. Thanks.

    • @Fred – Thanks for the compliment!
      As to making the posts display in a random order:

      1. It’s on the plugin’s TODO list (now … thanks, again);
      2. Until I can fit it into my schedule, have a look at the following code line (at or near line 235).
      query_posts( "cat=$cat_choice&posts_per_page=$show_count&offset=$offset" );

      Change it to:

      query_posts( "cat=$cat_choice&posts_per_page=$show_count&offset=$offset&orderby=rand" );

      This is untested, but should work … I will look at adding options to order the posts in the three standard methods of ascending, descending and random in a future update.

  • Fred says:

    Thanks that worked fine. You have a great plug in. I bought and used Recent Posts Pro but it does not function properly in Opera. I have had a lot of readers emailing and complaining. Your program works in all the major browsers I have tested. Chrome, IE, Firefox and Opera. Recent Posts Pro has some pretty cool features but even it lacks a way to indicate “SHOW POSTS OLDER THAN…. and then a date”. This would be an excellent way to draw attention to old posts. I have tried a lot of plug ins but none work well for showing old posts. Instead within Recent Posts Pro I can list the ID of posts that I want to randomly show. It’s a bit tedious but it lets me target those old posts and bring them back to life. You might want to consider that for your plug in. Either or both would work. Either selecting older posts by ID AND/OR selecting a BEFORE DATE to show older posts would work. You could certainly consider charging a small fee for your category plug in when you add those types of features. There is just nothing available that actually works and certainly nothing that is being maintained and updated. Many of these post type plugins are years old and do not work well. Thanks again and I look forward to your next update. Hope you add the random as a select so I can show some recent posts by ascending or descending and others by random. That would be great! Take care.

    • @Fred – I’m glad that modification worked; it shouldn’t take a lot to add it as an option. Now, the idea of a date range option as well, that is intriguing … I’ll add it as a review item. Thanks for the idea!

    • @Fred – Just a quick update note … I have worked out the post order option. Although I haven’t released it to the WordPress Extend Plugins repository, yet, it is available for testing purposes from its GitHub repository here. Feel free to give it a run; I’m still playing around with the date range idea.

      • Fred says:

        Checked it out, works really well! I checked it in Opera, Chrome, Internet Explorer, and Firefox and it works fine. I was wondering where in the code the padding or margin is that controls the space between the bottom of the text and the next article – not the space in between the articles, but in the article itself. Hope this isn’t too confusing. Basically, I notice I have a fair gap of probably a full line before the end of the article. I would like to tighten that up a little bit, but I can’t find where the padding or margin settings are for each article being shown. Thanks for all your help! You have a great plug-in. I look forward to further updates!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2009-2012 BuyNowShop All rights reserved.
This site is using the Custom Child-Theme, v1.0.3, on top of
the Parent-Theme Desk Mess Mirrored, v2.0.3-beta, from BuyNowShop.com.