Skip to content

Link to previous/next entry using custom sorting order

23 Apr 2010

Link to previous/next entry using custom sorting order

The weblog:entries tag enables you to link to next/previous entry based on entry creation date.
But what if you want to use sorting order based on other parameter, and still have next/prev links?
Here’s the add-on that will help you!

This is add-on for EE 1.x. If you are looking for EE 2.x version, click here.

Using Entry Linking plugin, you can sort your weblog entries based on any - standard or custom - field you want and make your next/prev links follow that order!

Example usage:

{exp:entry_linking entry_id="1" link="next" weblog="my_weblog"
 
orderby="my_custom_field" sort="ASC" status="open"
 
category="1|2"
 
mode="short"}
<a href="{path=site/{link_url_title}}">{link_title}</a>
{/exp:entry_linking} 

entry_id is the required parameter.
Possible values for link are ‘next’ and ‘prev’. Defaults to ‘next’.
You can use your custom field names for orderby parameter (defaults to entry_date).
All returned variables will be prefixed with ‘link_’

You can use the plugin in any part of your template.

The current version of plugin supports only ‘short’ mode (i.e. return only entry_id, title and url_title). I don’t think you need more for pagination smile But if you do - please let me know and I’ll include ‘full’ mode in future releases.

The plugin currently supports only EE 1.x, EE 2 support is coming very soon.

For support, please email .(JavaScript must be enabled to view this email address).

Licensing & support terms

Attachment

Comments

  1. Jani Komulainen
    Jani Komulainen 26 Apr 2010

    Thanks! I was just looking for something like this, but couldn’t find anything even remotely useful. Works just great and is flexible enough!

    One suggestion though: maybe the first/last links could be hidden if viewing the first/last entry? Now the links are looping the whole weblog. Just an idea smile

  2. Yuri Salimovskiy's avatar
    Yuri Salimovskiy 26 Apr 2010

    Jani, you can achieve this by replacing

    if ($link=='next')
        
    {
          $pos
    ++;
          if (
    $pos==count($ids)) $pos=0;
        
    else {
          $pos
    --;
          if (
    $pos==-1$pos=count($ids)-1;
        

    with

    if ($link=='next')
        
    {
          $pos
    ++;
          if (
    $pos==count($ids)) return $TMPL->no_results;
        
    else {
          $pos
    --;
          if (
    $pos==-1)  return $TMPL->no_results;
        
  3. James Mathias
    James Mathias 03 Jun 2010

    great plugin, thank you.

    It would be awesome if you could limit the next and prev links to a specific category as well.

    Would that be difficult to accomplish?

  4. Yuri Salimovskiy's avatar
    Yuri Salimovskiy 03 Jun 2010

    James, that sounds like a good feature. I think I’ll code that and release in a week or two.

  5. Ian Pitts
    Ian Pitts 03 Jun 2010

    I second the request to limit to specific categories. That would be awesome.

  6. Steve Hopper
    Steve Hopper 11 Jun 2010

    Nice plugin. Thanks.
    Can you let me know when it’s been updated to ‘limit to specific categories”. That would be perfect for a project I’m working on smile

  7. Yuri Salimovskiy's avatar
    Yuri Salimovskiy 11 Jun 2010

    The ‘limit to specific categories’ feature has been implemented. Use it by passing parameter catagory=“1”. You can specify multiple categories by separating them with a pipe.

    Please note that I did not test myself this yet smile so if you encounter any bugs, report them here.
    The donwload link is in the post above.

  8. Steve Hopper
    Steve Hopper 12 Jun 2010

    Hey,
    Thanks for the update.
    Have given it a go but I can’t get it to limit to the category I’m on. The ‘category’ tag doesn’t seem to have any effect. Has any one else had any issues?

    Cheers

  9. Yuri Salimovskiy's avatar
    Yuri Salimovskiy 12 Jun 2010

    Steve, do you use ‘category’ tag or parameter? You should use parameter (like in example in docs).
    If you are willing, I can have a look at your installation and quickly fix everything.

  10. Yuri Salimovskiy's avatar
    Yuri Salimovskiy 12 Jun 2010

    Soon after - bugfix version (1.2). Please download and install this one.

  11. Mason Kessinger
    Mason Kessinger 21 Jun 2010

    Great plugin!

    I second the request to be able to turn off the looping between the last-to-first and first-to-
    last of the results.

    Could you provide any quick fixes to this?

  12. Mason Kessinger
    Mason Kessinger 21 Jun 2010

    Eek, I just noticed that you had followed up already on this topic. I was thrown off by the order of the comments.

    The fix you posted worked really great! Thanks again for an awesome plugin.

  13. Yuri Salimovskiy's avatar
    Yuri Salimovskiy 22 Jun 2010

    You’re welcome, Mason smile

  14. ibuybattery
    ibuybattery 02 Sep 2010

    Very useful article.Surely will visit your blog again later,thanks for sharing.

  15. maz
    maz 29 Oct 2010

    Hi, I am hopeing to use this plug-in for pagnation within a gallery created using channels. The problem I have is that the plug-in isn’t showing in the manager. I have uploaded the plug-in to the ‘third party’ folder, and like other plug-ins I’m using I expected it to automatically show? I’m using EE2.
    Many Thanks.

  16. Yuri Salimovskiy's avatar
    Yuri Salimovskiy 29 Oct 2010

    Hello maz,
    this is plugin for EE 1.x
    I have development of version for EE2 in my plans, but that will probably not free anymore. Would you be willing to pay a small fee (like $5) for such plugin? If yes, I can start development immediately and it will be ready soon.

  17. Maz
    Maz 02 Nov 2010

    Hi, Thank you for your reply. The user guide for EE pagnation states:

    “Pagination will also automatically restrict itself to any category you’re currently viewing. So if you have a category specified in your channel entries tag or you are viewing the entries of a category, then the pagination links will automatically restrict themselves to only entries in that category.

    So I shouldn’t need a plug-in. I’m going to dabble some more and try figure this out, but thank you for offering and I may get back to you (I hope thats ok).

    Thanks again.

  18. Yuri Salimovskiy's avatar
    Yuri Salimovskiy 02 Nov 2010

    Glad you figured that out. The main feature of this plugin is custom sorting order and not category restiction, after all.
    Do not hesistate to contact me again if you need any help.

  19. strudel
    strudel 13 Nov 2010

    I’d be quite happy to have a 2.1 version of this, and would also be happy to $5 for it. I’m working on a 2.1 photo gallery site, and it sounds like this would just be the thing I need.

  20. strudel
    strudel 13 Nov 2010

    Oh, additionally: what I’m really looking for is also to be able to filter for the last entry so that the “next” button will take you to an entirely different page, say, the front page of the site or whatever. Is that possible?

  21. Yuri Salimovskiy's avatar
    Yuri Salimovskiy 13 Nov 2010

    Hi strudel.
    The feature you request is possible.
    Expect EE 2.x version in a few days (I’ll let you know)

  22. Yuri Salimovskiy's avatar
    Yuri Salimovskiy 16 Nov 2010

    For all of you interested,  the Entry Linking for EE 2.x is available on this page and from Devot:ee

  23. QPoigreeli
    QPoigreeli 14 Jul 2011

    get facebook likes
    how to get facebook likes
             
    get 1000 facebook likes buy facebook likes get 1000 facebook likes          
    o.k. this thing called security tool kept popping up and telling me all these viruses I had on the computer. Well now it completely blanked out my screen making it the only thing visible and everytime I try presing Ctrl + Alt + Delete to go to my task manager it blocks it off with a virus pop up!!! The only way i’m on the internet right now is because I went threw start… PLEASE help me, there is absolutly no way for me to get this of my computer! Now it says it has a firewall up that blocks my internet. This is doing more harm then good as you see obviously.   
    I’m a I.T. student.And also about virus related,antivirus software related websites also i need.Please help me out.Advance Thanks!!!  buy facebook likes        
             
    get 1000 facebook likes get facebook likes <a >how to get facebook likes </a> get 1000 facebook likes

Comments are closed. To get support, email .(JavaScript must be enabled to view this email address).

Featured EE Add-ons

About

    Hello, my name is Yuri and I specialize in creating custom add-ons (plugins, modules, extensions) for ExpressionEngine CMS.
    You can email me .(JavaScript must be enabled to view this email address)