Category content

Last changed: August 29, 2014 Comments: 50

This WordPress plugin (widget) will be shown when visitors are viewing a single post, category page or both. Otherwise, it wont be there at all.
The widget contains a list of post titles from the same category(s) the visitor is viewing the post from, so the visitor is able to swiftly change posts by clicking on the titles shown.
Posts published in multiple categories are taken care of just fine. I’ve introduced a new feature in version 1.6 which gives you the possibility to show all the categories the post has been published in or the category where the visitor has been spotted the last time(uses cookie).

The widget can be controlled with the following widget options:

  • Title (before the category name(s))
  • Exclude category(s) by ID
  • Exclude categories on: Single, Category, Both, None
  • Sticky posts on top: Yes | No
  • Show posts from year: a specific year or all years
  • Show widget on: categories | single posts | both
  • Show category title(s): Yes | No
  • Post has multiple categories – what now: Show all categories | Show the last category viewed
  • Show how many posts
  • Single posts view – Order: DESC | ASC
  • Single post view – Orderby: Author | Category | Date | ID | Random
  • Category view – Order: DESC | ASC
  • Category view – Orderby: Author | Category | Date | ID | Random
  • Remove/Keep child categories

How to use ?
Just install the plugin as you are used. Go to the admin panel and choose “Widgets” which you can find under “Appearance”. Put the widget into a sidebar and customize the settings!

Version: 0.6.0:

  • Added: Option (Control child cats)

Version: 0.6.1:

  • Fixed: Added title attribute

Version: 0.7.0:

  • Added: Choose where the widget must be shown
  • Added: Separate control for Order & Sort options

Version: 1.1:

  • Fixed: Fixed some minor ugly coding mistakes
  • Added: Added a default class to the list item (category-item)
  • Added: Added a list item class to the current shown post (category-current-item)
  • Fixed: Fixed the issue concering the option which will show the widget on category pages and single posts (didn’t work properly)

Version: 1.3:

  • Added: Added the possibility to show posts from a specific year or all years

Version: 1.6:

  • Added: Added the possibility to exclude categories from the widget entirely
  • Added: Added the possibility to control the excluded categories by specifying where to exclude them: single post, category, both, do not exclude anything
  • Added: Added the option that when a single post has multiple categories, you can choose if you want to show all those categories or just the last viewed(uses cookie!)

Version: 1.7:

  • Fixed: Buffering

Version: 2.0:

  • Added: Added the possibility to show sticky posts on top of the list
    • Sticky posts will be ‘ordered by’ and ‘sorted’ using the same configuration as ‘Single post/Category view’ – ‘Orderby’ and ‘Order’
  • Fixed: Bug showing last viewed category – did check cookie while post was published in 1 category – now it shows the category just as expected
Attachments 5 image(s) & 0 video(s) found.
Category content for WordPress
Category content for WordPress
categorycontent.zip
Version: 2.0
5.9 KiB
Details...
  1. Sam says:

    Hey – this is really a fantastic plugin.

    One thing though – is it possible to configure it so that the widget will only show more posts from the subcategory level?

    For example if I am on a post in /category1/subcategory1/ I only want to show more posts from /subcategory1/, not /category1/ AND /subcategory1/.

    If that would be possible, I think this plugin would be flawless. Thanks again!

  2. TheWriter says:

    For my understanding….. You want to exclude the parent category(s) ? The same for child category(s) ?

    Cheers

  3. Sam says:

    exactly – I only want to show posts for the exact sub category I’m reading a post in, not any posts from parent categories.

  4. TheWriter says:

    Hi Sam,

    I dropped a file in your mailbox. Please replace the current plugin file with the one i just dropped.

    let me know.
    Cheers

  5. // kevin says:

    I needed to remove a duplicate entry from the title tag (had posts in topic1/province and topic2/province), and also wanted to remove the link that would come up in the widget for the current post and added this:

    # override by // kevin to get rid of duplicates
    $CatTitles = get_cat_name($IDS[0]);
    # page to exclude from list in widget by // kevin
    $thePostID = $post->ID;
    # Post arguments
    $args = array(‘orderby’ => strip_tags($instance['orderby']),
    ‘order’ => strip_tags($instance['order']),
    ‘post_type’ => ‘any’,
    ‘post_status’ => ‘publish’,
    ‘numberposts’ => strip_tags($instance['amount']),
    ‘category’ => $CatID,
    ‘exclude’ => $thePostID);

  6. TheWriter says:

    Hi Kevin,

    1. Which version do you have of this plugin ?
    2. Could you please give me your website so i can see the problem.

    This plugin checks whether your post has been placed into multiple categories. As long as you have no posts, placed @ multiple categories, you can change the above code without any problems.

    However, i will note your comment for future updates if needed.

    Cheers

  7. lrsamuel says:

    Hi MrXHellboy,

    First of all, this is a great plugin. Thank you very much for creating it. I have 2 questions for you:

    1. Is there a way to have the header of the widget have custom text, instead of just a listing of the category? For example, I post video entries on my blog. Right now, it shows links to the categories. I would like it to say something like “Other Videos in this category”, and not link to the actual category.

    2. Is there a way to also have it show up on the category pages? For example, when someone goes to mydomain.com/category/videos/, it shows the most recent 10 videos in that category. I would like to have it also show the widget in my sidebar then.

    Looking forward to your response.

  8. TheWriter says:

    Hi Irsamuel,

    Both your requests could be done. I will look into it next week and update the plugin. I will send you a “test” version by email so you can check the updated plugin.

    Cheers

  9. lrsamuel says:

    Oh wow, that would be awesome. I don’t know if you want to think about one more feature, but what would be AWESOME is if you can give it the ability to show the post thumbnail if someone chooses to do that. Somethings small – maybe like 35×35 pixels. Please think about it :)

  10. TSG says:

    Hi Lauren,

    Great plugin – saved my bacon this week, thanks!

    I’ve put the widget in the sidebar and I was hoping that the title field would override any default output? Currently it appends the category name (e.g. “Recent posts in category name”) when all I really want is “Recent posts” (I had to add “in” to make a sentence).

    Using v0.7.0, a fresh install of WP and TwentyTen on localhost.

    All the best, Karl

Just tell us...