Employment

Kuwait

Lifestyle

Reviews

Society

Home » Programming, Wishlist

Wordpress Plugin: Show Posts by Selective Category

Submitted by DA on Thursday, 18 October 200718 Comments

Show Posts by Selective Category‘ is my first plugin for Wordpress 2.3.x. This plugin will allow you to show specific number of posts from a selective category. To use this plugin, you have to place a tag in the following format in your posts or pages [pbc=CategoryID count=num_of_posts]

Example

To show 4 posts from category with ID 22

    To show 100 posts from category with ID 6

      Download this plugin from Wordpress [LINK]

      18 Comments »

      • Harald Dietrich said:

        I just discovered your Wordpress plugin ´Show Posts By Selective Category´.

        So this sweet piece of code could save me a lot of time and trouble if I would
        be able to not only specify the category and number of posts but also a offset
        parameter in case I want to exclude the first x posts because of style
        reasons.

        This small change would make your plugin to a priceless part of my code.

        If my suggestion is easy to inplement than I would be more than happy to
        receive the modded code from you (Im a php noob ..)

        Thank you and have a great time. Harald

      • nothing said:

        its not even working with wp 2.3, why not use php to call it on the page ?

        [ ] doesn’t work

      • asony999 said:

        Hi,

        I have downloaded the plugin and tried to use, but I can’t find how to use this one ? or perhaps it is not working in wordpress 2.3

        Thanks.

      • Harald said:

        I use WP2.3 and this plugin works fine.

      • Bruce said:

        thanks, you saved me from banging the head against the wall.
        :)
        i find it pretty “peculiar”, that there isn’t any built-in function in wordpress for doing this - at least that i know of…

      • zeb said:

        It does not work with WP 2.3.1 :s
        showing this code [pbc=1 count=10] in browser when i tried to display 10 posts from category with an ID of 1. I think WP is not recognizing the code.

      • Maximus said:

        I would like to see a continuation of the topic

      • Ulises said:

        i also got the same result as Zeb, i am wondering as to how exactly di d Harald got it to work…

        harald?? :)

      • Sid said:

        lol, I thinks you are not gonna check for the taxonomy id but for term id.

      • Dreamerr said:

        I have this working on both WP 2.33 and 2.5

        There is something strange with the category numbers, sometimes they make sense, sometimes they dont!

        I made a test post with all category numbers from 1-20 to see what worked.

        Click my name to visit HollowVision.com which uses this plugin 4 times on the front page. Great plug once you figure it out!

      • Wardeh at GNOWFGLINS said:

        Hi, I am working with your plugin to create a list of recipes in categories. How would I go about getting the list of posts to be alphabetized? I am using WP 2.5.1 and it appears to be working.

        Thank you.

      • Wardeh at GNOWFGLINS said:

        Actually, it is not working. There is a funny rectangular box before each list of posts. And also, it isn’t pulling up the right posts in each category.

        Thank you.

      • Phil said:

        I found an error in the code that makes it not work correctly at least with Wordpress 2.6, it doesn’t get the category correct.

        You need to change the code on line 17 which does the database query.

        I will try to post here, not sure if WP will mangle the code in the post.


        $pbcresults = $wpdb->get_results(”SELECT * FROM $wpdb->posts,$wpdb->term_relationships, $wpdb->term_taxonomy WHERE $wpdb->posts.post_type = ‘post’ AND $wpdb->posts.post_status = ‘publish’ AND $wpdb->term_taxonomy.term_id=$catid_in AND $wpdb->posts.id =$wpdb->term_relationships.object_id AND $wpdb->term_relationships.term_taxonomy_id=$wpdb->term_taxonomy.term_taxonomy_id order by $wpdb->posts.post_date desc,$wpdb->posts.post_title asc LIMIT $count”);

      • Phil said:

        Hey,

        Since you updated to 1.5 and used my code above why not give credit where credit is due? Anyway thanks for updating…

        ~Phil

      • Jason said:

        I’m currently using this plugin. I wanted to know is there any way I could display the date of the post along with the title for this plugin. If there is some code I could use to edit the existing plugin to have it display date of the post as well? If you could email me to let me know, I would appreciate it :o)

      • cobalt said:

        Is there a way to show the contents of the posts, instead of links to the posts?

        thank-you, ver 1.5 works well as described for WP 2.63

      • vaibhav said:

        Hi, This plugin is too good and useful but i need description with same as link can any one please let me know about this

        Thanks..

      • Show Posts By Selective Category_Wordpress plugin said:

        [...] Plugin Homepage [...]

      Leave your response!

      Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

      Be nice. Keep it clean. Stay on topic. No spam.

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

      This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.