jump to navigation

Wordpress plugin: recent posts list with short titles 24 August 2006, 16:53

Posted by Orhan in : Geeky Techy Stuff, WP-Plugins , trackback

Updated: 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:

  1. Put oden_latest_posts.php file under wp-contents/plugins folder
  2. 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»

1. Chris - January 23, 2007 Trackback

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 ;)

2. Orhan - January 23, 2007 Trackback

It is fixed in ver 1.02.. Thanks for the comment.

3. Chris - January 24, 2007 Trackback

sweet, tested here and worked fine. ^^ Thanks for the plugin ;)

4. chris - January 30, 2007 Trackback

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 ^^

5. Orhan - January 31, 2007 Trackback

Done :). Ver 1.04 is what you want ;)

6. Orhan Dengiz’s BlogSite » New version: Wordpress plugin: recent posts list with short titles - January 31, 2007 Trackback

[...] Ver 1.04 - Plugin page [...]

7. chris - January 31, 2007 Trackback

thanks for you quicky reply.almost worked…only offset didnt work for me ;_;

8. Orhan - February 1, 2007 Trackback

hmm. can you copy&paste your implementation here so that I can comment on it?

9. Orhan - February 1, 2007 Trackback

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.

10. The Technical Exorcist » Handy Plugin - February 4, 2007 Trackback

[...] 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 [...]

11. AL - February 21, 2007 Trackback

Hi quick question

I’d like to use the skip posts functionality (offset) with trimming the posts titles. Can I do that?

12. Orhan - February 22, 2007 Trackback

Yes, that is exactly what the plugin is supposed to do. Just use it as described in the example above.

13. AL - February 22, 2007 Trackback

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

14. Orhan - February 22, 2007 Trackback

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:

if ( ” == $title_limit ) {
$title_limit = ‘500′;
}

to

if ( ” == $title_limit ) {
$title_limit = ‘5000′;
}

15. AL - February 22, 2007 Trackback

Thanks alot Orhan .. now I can cross this off my to do list :)

16. AL - February 22, 2007 Trackback

With this code

I wonder why it’s showing some static pages along with the posts? Shouldn’t be displaying posts exclusively?

17. Orhan - February 22, 2007 Trackback

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 :)

18. Orhan - February 22, 2007 Trackback

AL, if you are using WP 2.1, plugin Ver. 1.05 will fix it for you.

19. Mike - June 5, 2007 Trackback

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.

20. Alisha - June 18, 2007 Trackback

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!

21. Orhan - June 18, 2007 Trackback

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

22. Alisha - July 15, 2007 Trackback

I apologize for my late reply as well. 1.06 removes the static pages and WP 2.2 sees the plugin. Thank you!

23. alper - August 8, 2007 Trackback

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

24. Arshad merali - August 25, 2007 Trackback

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?


Counter

Log in