Update: Category Posts Widget has been updated to version 3.0!
As promised, I’ve updated Category Posts Widget. Version 1.3 brings one new feature to the table: an option to show a post excerpt. I also converted the widget to the new WordPress 2.5 system of adding multiple widgets so 1.3 will only work on WordPress 2.5 or later. Please donate if you like this plugin! Full list of changes below.
Changes:
- New option to display post excerpt below permalink.
- Display as many posts from a category as you want.
- Add as many widgets as you want.
- WordPress 2.5 or later compatible only.
Note: You may have to reconfigure your CPW widgets if you are upgrading from a previous version.
Download
You can download Category Posts Widget 1.3 at the official WordPress plugin repository.
Donate
This plugin was created by me and is made available free of charge. However, if you would like to show your appreciation, you can donate via PayPal by clicking the donate button in the sidebar. All funds go towards paying for my college expenses.
Is there a way to get the category title NOT to show? Thanks!
Hi, i installed your plugin but as i’m using jLanguage to make posts in english and spanish your plugin show the post titles as [english]Title[/english][spanish]Titulo[/spanish].
That is the syntax jLanguage uses to know which language to show but the default Recent Posts widget of WordPress show the titles correctly.
Is there anything you or i can do to solve this? Many thanks.
Pingback: avaz.blogger.uz » Downtime
hi,
an addition:
inspired by http://www.mydigitallife.info/2006/06/24/retrieve-and-get-wordpress-post-id-outside-the-loop-as-php-variable/ I wanted to highlight the current post. Change from line 54 (should be easy to find)
global $post;
$IDOutsideLoop = $post->ID;
foreach($cat_posts as $post) {
setup_postdata($post);
echo ‘ID . ‘ ‘ . ((is_single() && $IDOutsideLoop == $post->ID) ? ‘current-post’ : ”) . ‘”>‘ . $post->post_title . ‘‘;
gives your current viewed post also the class ‘current-post’.
btw lily (above me): if you need a quick fix, just put one space (” “) in the title
argh, code breakdown… mail for code
I have a problem with the widget.
I’m using it with excerpts as a microblog on my site, but when I installed “the Ultimate Category Excluder” plugin, it stopped working and now posts from all categories show in the widget.
Any tips on how fix the compatibility or other ways to show one category posts only in the widget and not in the feeds or main page?
do image and double reply work with this
hey, I have a 3 column theme, and the part i want to use your plugin does not support the widgets automatically – is there a code to call the plugin? like <php…. etc… thanks!
hey there, great plugin….
I am using it to show the latest post from a specific category on the sidebar.
However, when the option “display excerpt’ is selected,a nd the post contains a video embeded, the video doesnt show on the sidebar.
Is there something I am doing wrong ? Is it not possible with this plugin?
Thanks
Hi,
I have noticed that you can only select from the first 8 categories created.
Has anyone else had this problem
Thanks
I’ve noticed the WP2.7 sticky functionality is ignored by this plugin. I’ve made a little change to the code to support stickies.
Originally, lines 39 and 40 of cat-posts.php read:
// Get array of post info.
//$cat_posts = get_posts(‘numberposts=’.$num.’&category=’.$cat_id);
Simply replace line 40 to this:
//$cat_posts = get_posts(‘numberposts=’.$num.’&category=’.$cat_id);
$cat_sticky = get_posts(array(‘post__in’=>get_option(‘sticky_posts’),’category’=>$cat_id));
if($cat_sticky[0]){
$num -= count($cat_sticky);
}
$cat_nonSticky = get_posts(array(‘post__not_in’=>get_option(‘sticky_posts’),’category’=>$cat_id,’numberposts’=>$num));
$cat_posts = array_merge($cat_sticky,$cat_nonSticky);
wescht, I tryed your bit of code in order to get a “current” style but with no luck… can someone heeeelllppp…
Nice plugin.
I’m getting a pretty serious indent of the body of the post underneath the title (ee sideblog 2 in the side bar). Any way to edit the php or css to chnage the size of the indent?
Thanks
Great plugin, thanks!
I fixed a couple of bugs that I found when using it on my blog, and I figured you’d want to know.
When using excerpts and not excerpts in the same category, and multiple widgets on one page using WP 2.7.1, I noticed that it was displaying the same excerpt on a number of the posts.
So around Line 50 (ish) I added:
global $wp_query, $post;
$wp_query->in_the_loop = true;
I’m not sure if the $wp_query stuff is needed anymore, I added that during the course of tracking the bug down.
I also noticed that a few lines below that, where you have the multiple lines in a row that start with $excerpt_ =, the line immediately after those, you use $excerpt – so in the widget, it displays a “1″ instead of the excerpt
Thanks for developing this!
@Ryan (post 60):
I have the same problem. After deleting and re-creating categories they can no longer be selected in the widget.
EXCELLENT!!!!!!!
This is EXACTLY what I was looking for. I was banging my head against the wall trying to find something like this.
I use your widget on my blog (http://www.ragnarockmusic.com/ and it only shows the most recent post on my blog regardless of which category I choose! Please help! I really would love for it to work. Thank you!
@ Jason
OH MY GOD! THANK YOU SO MUCH!!!!
I looked EVERYWHERE for someone to help me with that problem and your solution FIXED IT! James you have to include this in your next update. AMAZING! YOU’RE A GENIUS DUDE!
THANKS!!!!!
this plugin is very good but not solve the problem exactly. if you add “current category” between the options in post widget it would be better. i mean that if visiters are reading a post in category A, they will see last 10 post in category A then reading a post in category b, will see last 10 post of category B in sidebar.
Thanks..
I need help! What is the php code to use in order to place a widget in a footer area I created in mt theme? My footer is not set up in the theme to use widgets so I need to place the code manually.
ex) I want to pull 5 posts from category 16 with no excerpts?
Please help!!! thanks
I am a novice for sure. Can someone tell me the php code I could use to manually place this widget in my theme (not using the widget panel in WP)
post #1 mentions it, but it doesn’t work for me…
function c2c_get_recent_posts (
$categories = ’16′,
to add the replace line 55 with:
echo ‘ID . ‘”>‘ . $post->post_title . ‘ ‘;
the_date(‘d-m-y’, ”, ”);
er damn it coded got parsed. To add the date replace line 55 with this code: http://tinypaste.com/07b78c6
Hi,
wescht wrote a good hint with a bit of code that does not work – unfortunatly; I am not programmer…
The code below contains something wrong – but as I am not bvery good in PHP, I need a bit of help.
global $post;
$IDOutsideLoop = $post->ID;
foreach($cat_posts as $post) {
setup_postdata($post);
echo ‘ID . ‘ ‘ ((is_single() && $IDOutsideLoop == $post->ID) ? ‘current-post’ : “) . ‘”>’ . $post->post_title . ”;
The code is here as well: http://tinypaste.com/d1a37
Regards,
Gérald
thank you so much for the plug in! is there a way to not limit the page to 25 posts? just have it where it shows all posts?
thank you!
E
I’m not sure if the $wp_query stuff is needed anymore, I added that during the course of tracking the bug down.
is there any where written how to use the category post widget please? i installed it and activated it, but i don’t know how to place it at the sidebar of my website. I want to list latest news.
good sharing, thank you.
Getting a nice syntax error from jQuery “unrecognized expression:[@name='photo_id']” from js\media-panel.php ln 91 on Chrome, FF and IE.
It’s the @ in that line, since jQuery deprecated that notation since v1.2. Just did a find/replace (since there’s more than occurance) and it works.
Hi!
Great plugin but a I have a small problem with a blog i’m working on, http://deyamg.gr/. The widget is placed on the right sidebar, on the first box. I also have to mention that all the menu tabs are categories and the blog-pages are on the footer.
The problem is that the post-title(blue color) inherits the date(green color) from the date that the page/category you have clicked has been created and NOT from the date that the specific post has been added.
So, the green date under the blue title keep changes according to the page/category you visit.
Any ideas????
Thanks !!
marianna
THANK YOU! I’ve been beating myself up over this for a few days.
…then, finally — ran into your widget and BAM! Exactly, and I mean *exactly* what I needed.
I feel so relieved.
..again – Thank You.
Hi,
I’m wondering if there’s a simple way to reverse the order of the posts listed in your widget?
The site is for a book that I’ve written, and each post is a chapter of the book. At the moment, the posts are displaying in the traditional order — oldest last. I need it in the reverse, so I can update a chapter at a time.
Thanks for your help
L.
The problem can be fixed with the code below, replacing the default one about the date:
$Timestamp=strtotime($post->post_date);
echo ” . date(“d-m-Y”, $Timestamp) . ”;
So now the post shows the date the post was added and not the current date.
marianna
How can I go about theming the widget with CSS? Where in the code do I place the classes?
I’m also wondering how can i reverse the order of the posts listed in the widget?
So it’ll be ordered by the date it was published (which means oldest first)
Thanks
How can I display the last articles minus the last 6?
I have 6 articles on the front page from a category but I don’t want to display those again.
Also is there a way to limit the amount of charachters in the excerpt that shows up without limiting what the actual excerpt is.
Thanks.
Hi J,
Great plugin. Is there a way to show comments under the_excerpt?
Many thanks,
Ross
Thank you for this – while it is not 100% exactly the output I am looking for, the functionality is what I have been looking for for days! That being said (though it looks as though you have stopped responding/supporting this) how can I add the date of the post, so that it looks like this:
Title
Date
Excerpt
More Link
I have added the more link easily, but I cannot get date to work. I actually tried to add
echo the_date(); but that does not work because that can only be used in the Loop (I think) can anyone help?
Mike
Nevermind..emarianna’s code above worked perfectly..sorry I didn’t see that before!
@emarianna – great, but where do I add this?
thanks!
Anyone know how to add the date to the widget? Thanks.
Pingback: WordPress Plugins Give More Power To Bloggers