WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Stray Random Quotes] [all-quotes] paging links problem (5 posts)

  1. Frettsy
    Member
    Posted 5 years ago #

    I used the [all-quotes] function on my page here. they displayed fine but the paging links were being built incorrectly (http://calenfretts.com/index.php&qp=2 instead of http://calenfretts.com/quotes/?qp=2).

    my solution: change lines 261-262 in inc/stray_functions.php from:

    $baseurl = $_SERVER['PHP_SELF'];
    $urlpages = $baseurl.'&qp=';

    to

    $baseurl = '';
    $urlpages = $baseurl.'?qp=';

    in this way the link will be built with the current page.

    also, off topic, why is the "Select the version of WordPress you are using" on the "Add New Topic" screen not up-to-date?!

  2. corpodibacco
    Member
    Posted 5 years ago #

    Frettsy, you are absolutely right, a usual sloppy coding on my part. Your fix is perfect for custom permalinks except that it would not work if someone uses a traditional permalink with a ? already in place. But I'll think about it: and it will be fixed in the next version.

  3. Frettsy
    Member
    Posted 5 years ago #

    hmm.. I see you have changed the relevant code a bit, but now, if I click the next page link, it works correctly (http://calenfretts.com/quotes/?qp=2).
    but then, if I click another page link, it is incorrect (http://calenfretts.com/quotes/?qp=2&qp=3).

    the functions on this page should help:
    http://www.addedbytes.com/php/querystring-functions/

  4. Frettsy
    Member
    Posted 5 years ago #

    my fix was to add those functions into the code, then use

    $baseurl = remove_querystring_var($_SERVER['REQUEST_URI'], 'qp');
    if (strpos( $baseurl,'?'))$urlpages = $baseurl.'&qp=';

    notice I replaced '&' with '&' for XHTML standards.

  5. corpodibacco
    Member
    Posted 5 years ago #

    Of course you're right. And the functions you linked to are golden! At least for me who never studied any kind of programming language, and only navigates into PHP by sight.

    Frettsy, thanks a million for this post... I wish I had read it before I released the latest revision 1.8.3 yesterday :)

Topic Closed

This topic has been closed to new replies.

About this Topic