WordPress.org

Ready to get started?Download WordPress

Forums

upPrev Previous Post Animated Notification
Looking to do 2 things: Random and Stop before bottom of page (6 posts)

  1. adam533
    Member
    Posted 3 years ago #

    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.

    Thanks!

  2. adam533
    Member
    Posted 3 years ago #

    Anybody have an idea on how to accomplish this?

  3. Grzegorz Krzyminski
    Member
    Plugin Contributor

    Posted 3 years ago #

    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?

  4. adam533
    Member
    Posted 3 years ago #

    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!

  5. maxyRO
    Member
    Posted 3 years ago #

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

  6. Grzegorz Krzyminski
    Member
    Plugin Contributor

    Posted 2 years ago #

    @maxyRO,

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic