Support » Plugins » Hacks » the_excerpt_reloaded next / previous post

  • Hi,

    I try to display in single.php some improved ‘next and previous post’ buttons.

    I want them to be the same as the thumbnail (title, image, the_excerpt_reloaded, date…) in archive.php.

    > Everything is OK but impossible to get the the_excerpt_reloaded from a previous or next post.

    I just manage to call the full content.

    Please, any suggestion / idea would be great. I am really stocked.

    Thanks a lot!

Viewing 11 replies - 1 through 11 (of 11 total)
  • the_excerpt_reloaded is not a WordPress function so it probably needs some additional information/hacking to pull extracts from next/prev posts.

    If you can pull the full content, you could simply add some code to strip tags and extract X number of words for the extract.

    Thank you for your answer!

    Yes, the_excerpt_reloaded is a plugin. And that one like the_excerpt have a limited set of arguments – so impossible with it to ask for a specific post ID…
    Or maybe there is one but I didn’t find it?

    And I don’t think to be good enough to add this ID argument to those functions.
    I was wondering if anybody knows a nice hack for it?

    But you are right the straight solution is probably to strip the_content in single.php as I can have it. Also, I am a bit worry because the code will start to look like a mess.

    Well, any suggestions are very welcome 🙂 and thank you a lot for taking time to reply!

    The code doesn’t have to be a mess 🙂
    write a function that takes a string (i.e. the_content) as an argument and returns a shorten and stripped version of it. You can even borrow WordPress or the_exerpt_reloaded’s existing code to ensure you end up with something consistent 🙂

    Then just call the function whenever you need to.

    Yes 🙂

    Any idea for getting the categories of the previous / next posts on single.php?

    Thanks a lot for you help!

    Use this function to get the previous and next post

    Then you know what to do with the post object 🙂

    Well, I am not sure what to do to manage to get the categories of the previous / next post with this function.
    It is not returning anything?

    I use it to know if there is an adjacent post as I saw it used like it:
    <?php if(get_adjacent_post(false, ”, true)) : ?>

    But other than that I don’t know how to use it. Do you know?


    Yes I definitly have to use
    <?php query_posts($previous_post_p); ?>

    I just find why I am not managing to use the ‘normal stuffs’.

    The variable that I am passing: $previous_post_p
    is not understood as a string/chain of characters by the function. I have to change the content of $previous_post_p into a chain of characters… Have to find how to do that…


    Here is what is working and thank you Xephan.
    Things looks complex sometimes:

    <?php $actual_post_ID = $post->ID;
    $actual_post_p = “p=”.($actual_post_ID);
    echo $actual_post_p;

    <?php $previous_post = get_previous_post();
    $previous_post_ID = $previous_post->ID;
    $previous_post_p = “p=”.($previous_post_ID);


    <?php query_posts($previous_post_p); ?>


    It seems rather complicated, if you don’t mind trying to refine it.

    A cleaner code and subsequently easier to maintain code would be like this, again I don’t use this code so this is purely theoretical code you might have to debug/tweak

    $previousPost=get_adjacent_post(false, ”, true); //function returns an object if found
    if ($previousPost) {
    echo “Prettier Previous link to {$previousPost->post_title}“; //or do whatever you want with it


    Forgot to wrap the previous post in code quote so here it is again

    $previousPost=get_adjacent_post(false, '', true); //function returns an object if found
    if ($previousPost) {
      echo "<a href='$permalink'>Prettier Previous link to {$previousPost->post_title}</a>"; //or do whatever you want with it

    I might be a bit confusing.
    The data that I need from the next and previous posts are:
    img, the_permalink, the_title, the_excerpt, the_time, the_category
    So almost everything

    so I get the id of those next and previous posts and then call them with this wordpress loop if they are existing (<?php if(get_adjacent_post(true, ”, false)) : ?>…. )

    It works well and it is easy to do.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘the_excerpt_reloaded next / previous post’ is closed to new replies.