Wordpress plugin: recent posts list with short titles 24 August 2006, 16:53
Posted by Orhan in : Geeky Techy Stuff, WP-Plugins , trackbackUpdated: 06/18/2007 - Ver 1.06
For those who have experienced problems with WP 2.2, try this version 1.06..
——————————————————————————
I have searched for a long time and was unasble to find a plugin that can display recent posts with short titles so that the list is read one post per line.
Then I realized this was a good opportunity to write my own (and first) Wordpress plugin.
What it does is that it lists the recent posts just like wp_get_archives() function but an additional parameter sets the limit of the post title length as characters. Only the first X characters of the post title is displayed. The full name can still be read if the mouse is pointed on the links.
Current Version 1.06: -strip_tags on shortened titles eliminates html tag errors, this version should also work with no problems in WP 2.2
—V1.06 Download oden_latest_posts.txt (rename to oden_latest_posts.php)
Version 1.05: Converted for WP 2.1.x to fix a bug which caused static pages to appear in the list. I am not sure if it will work with WP ver. 2.0.x! WP 2.0.x users, do not upgrade at this time if you do not have any problems.
Version 1.04: Added offset feature. Skip the first n posts when listing. Also, when you move along the pages, it automatically skips the posts on thatpage too.
—V1.04 Download oden_latest_posts.txt (rename to oden_latest_posts.php)
Installation:
- Put oden_latest_posts.php file under wp-contents/plugins folder
- Activate ODEN latest posts in admin panel plugin area
Usage:
oden_wp_get_archives(…, $title_limit=XX, $oden_offset=XX);
where XX is the number of characters you would like to limit the post titles in the recent posts list.
Example:
<?php if($paged || is_home()) _e(’Earlier Posts’); else _e(’Recent Posts’); ?>
<ul><?php oden_wp_get_archives(’type=postbypost&limit=20 &title_limit=34&oden_offset=10′); ?></ul>
Note: put no space before &title_limit. I had to put a space because it did not fit here!
Demo: In the side bar recent/earlier posts.
Hope someone else finds it useful too!
Comments»
it’s almost perfect. i only wanto to know how to only show the dots”..” when the title is too long.
When i had a shot title it show the dots too. ^^
thanks waiting for your reply
It is fixed in ver 1.02.. Thanks for the comment.
sweet, tested here and worked fine. ^^ Thanks for the plugin
Hi its me again ^^
well, i noticed that with get_archives i can exclude the post on homepage…only with get_posts i can do that( with offset).
How can i use your code with get_posts? i need to excluse the first 2 posts from the list.
thanks ^^
Done :). Ver 1.04 is what you want
[...] Ver 1.04 - Plugin page [...]
thanks for you quicky reply.almost worked…only offset didnt work for me ;_;
hmm. can you copy&paste your implementation here so that I can comment on it?
I forgot to mention that it will offset only when you are viewing pages. In other words, your blog homepage will skip oden_offset number of posts. If you navigate to older posts (next page) then 2*oden_offset number of posts will be skipped.
If you are viewing a single post, there will not be any posts skipped.
[...] the web for a Wordpress plugin that would do the job. I managed to find one that works well called ODEN latest posts. Simple installation, and works [...]
Hi quick question
I’d like to use the skip posts functionality (offset) with trimming the posts titles. Can I do that?
Yes, that is exactly what the plugin is supposed to do. Just use it as described in the example above.
Umm .. sorry .. i thought you’d pick that i meant “without” trimming the posts titles. I want ‘em full but I just want to use it for the offset. Possible?
Thanks
If you omit the title_limit parameter, it defaults to 500 chars, which I suppose should be enough for most post titles. If you need longer, you can edit the plugin and change:
to
Thanks alot Orhan .. now I can cross this off my to do list
With this code
I wonder why it’s showing some static pages along with the posts? Shouldn’t be displaying posts exclusively?
Which WP and plugin versions are you using? You are right. Static pages are not supposed to appear! I have had that too, but I thought I fixed it. So if you are using the latest plugin version, apparently a new version is due
AL, if you are using WP 2.1, plugin Ver. 1.05 will fix it for you.
Just tried installing 1.05 with WP 2.2 … copied the php file to my plugins directory and WP admin -> plugins doesn’t see it so I can’t activate it. I uploaded 1.04 and WP 2.2 activates it. Of course, 1.04 shows the static pages.
Any fix for this? Nice plugin, btw. Thanks for the hard work on this.
I love this plugin, it is perfect because I wanted exactly what it does! But, like Mike, I also had to install 1.04 because WP 2.2 didn’t see it.
Thank you for creating this plugin!
Mike and Alisha, try the 1.06 version and let me know if it works. I just upgraded to 2.2 and it worked for me.
Sorry for the late reply, I have been very busy lately.
Orhan
I apologize for my late reply as well. 1.06 removes the static pages and WP 2.2 sees the plugin. Thank you!
hello there, i tried to implement this to my footer but i couldn’t manage, here’s the story. I want it to show the recent 5 posts after the 10 on the main page. in other words, i want it to show the 5 posts starting from the 11th recent one.
my theme uses wp_get_archives in footer.php and as i just learnt wp_get_archives doesnt have an offset feature. and for some reason I can’t get get_posts feature to work in my footer (i didnt try it in my index.php by the way).
I saw your addon and gave it a shot but it didnt work as well, it keeps saying me that i have an error on my footer.php file, and I’m just using your code example on this site.
am i doing something wrong (I’m just copy-pasting - removed that blank too) or i can’t put such a code in footer? is there such a limitation?
thx in advance/alper
Not sure what I’m doing wrong… this is what I have now:
Recent Entries
“>
which shows the 8 recent posts… I tried to use your code (after installing the plugin) and dropped this in to the sidebar:
Recent Entries
but it gave me an error when displaying the page. Any suggestions?