Support » Plugin: upPrev — Next Post Slide-in Box » Looking to do 2 things: Random and Stop before bottom of page

  • Great plugin, this is exactly what I have been looking for. I am just looking to make two modifications and hoping somebody can help me. I am comfortable editing the upprev.php file, just not sure what I should be changing (and to what).

    1. I want it to display a random post from the category instead of just the previous post. In the php file I changed orderby to “rand” instead of “date”. The problem is the thumbnail and article title/excerpt do not match when doing this. It pulls two different ones. What else would I need to modify for this to work.

    2. I am wondering if I can have it disappear when it reaches a specific div. The way you can set the settings to have it appear once you pass a specific div class, can you add to that (in the php file) to have it disappear when it reaches another div class? It is blocking some information in my footer that I want visible.


Viewing 5 replies - 1 through 5 (of 5 total)
  • Anybody have an idea on how to accomplish this?

    Plugin Contributor Grzegorz Krzyminski


    1. You can keep your change with orderby, but you need to modify one more thing inside upprev.php:

    At line #50 you can find: previous_post_link(‘%link’,’%title’, true);

    You need to replace it with: echo "<a href='" . get_permalink($posts[$i]->ID) . "'>".$posts[$i]->post_title."</a>";

    2. This is the first time I’m hearing about such suggestion. Generally there would be a need to modify upprep_js.php. This is some overall thought but it might be helpful:

    You can find the code similar to this one:
    lastScreen = getScrollY() + $(window).height() < $("#comments").offset().top ? false : true;

    This should be modified to something like:
    lastScreen = (getScrollY() + $(window).height() < $("#comments").offset().top || getScrollY() + $(window).height() > $("#SECOND_SELECTOR").offset().top) ? false : true;

    Another, simpler possibility: why not to experiment with stylesheets and decrease value of z-index property for upPrev, to be lower than for footer?

    Thanks for the help, I really appreciate it.

    I never thought about the z-index option for the footer problem. I will try that tonight, I think that will work great.

    Thanks again!

    Is it possible that my plugin doesn’t have the function you stated at #1? I’m using version 1.4.0 and cannot find previous_post_link(‘%link’,’%title’, true);

    Plugin Contributor Grzegorz Krzyminski



    hmm.. I guess you were using automatic search and entered the exact text. It was already copied from different topic and it had replaced apostrophes ‘ with those directional ones ‘ so..

    File upprev.php, line #50: previous_post_link('%link','%title', true);

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Looking to do 2 things: Random and Stop before bottom of page’ is closed to new replies.