Category Posts Widget 1.3
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.
[columnsplit]
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.
80 Responses to “Category Posts Widget 1.3”
Leave a Reply
lily on January 29th, 2009
Is there a way to get the category title NOT to show? Thanks!
ajua on February 5th, 2009
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.
avaz.blogger.uz » Downtime on February 9th, 2009
[...] Category Posts Widget [...]
wescht on February 11th, 2009
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
wescht on February 11th, 2009
argh, code breakdown… mail for code
Johan Ronström on February 14th, 2009
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?
Amaizing Articles on February 27th, 2009
do image and double reply work with this
John on March 2nd, 2009
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!
Julien on March 10th, 2009
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
Ryan on March 10th, 2009
Hi,
I have noticed that you can only select from the first 8 categories created.
Has anyone else had this problem
Thanks
riekus on March 14th, 2009
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);
Gerald on March 16th, 2009
wescht, I tryed your bit of code in order to get a “current” style but with no luck… can someone heeeelllppp…
Robbie on March 23rd, 2009
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
Jason DeVelvis on March 30th, 2009
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!
JF on April 1st, 2009
@Ryan (post 60):
I have the same problem. After deleting and re-creating categories they can no longer be selected in the widget.
donny on April 3rd, 2009
EXCELLENT!!!!!!!
This is EXACTLY what I was looking for. I was banging my head against the wall trying to find something like this.
Aesamattki on April 5th, 2009
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!
Aesamattki on April 10th, 2009
@ 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!!!!!
Phys on April 14th, 2009
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..
bill on April 17th, 2009
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
bill on April 20th, 2009
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′,
qwik on May 2nd, 2009
to add the replace line 55 with:
echo ‘ID . ‘”>‘ . $post->post_title . ‘ ‘;
the_date(’d-m-y’, ”, ”);
qwik on May 2nd, 2009
er damn it coded got parsed. To add the date replace line 55 with this code: http://tinypaste.com/07b78c6
Gerald on May 9th, 2009
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
Eddie on May 21st, 2009
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
Cappadocia on May 31st, 2009
I’m not sure if the $wp_query stuff is needed anymore, I added that during the course of tracking the bug down.
Alessia on June 9th, 2009
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.
vaziyet on June 10th, 2009
good sharing, thank you.
emarianna on June 23rd, 2009
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
Todd on June 23rd, 2009
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.