Support » Plugin: WP Photo Album » [Plugin: WP Photo Album Plus] Incorrect page id used in links

  • Resolved Palamethos

    (@palamethos)


    When embedding the plugin into a page the URL’s to navigate the album are linking to the incorrect page id and it keeps redirecting you to a different page.

    The wppa_functions.php file is using the get_permalink() function and this only works for posts apparently. So the id generated is of the last post id and not the current page id.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Palamethos

    (@palamethos)

    Suggest declaring a variable at the top of the php file:

    e.g. $globaluri = $_SERVER[‘REQUEST_URI’];

    Then find and replace all mentions to get_permalink() with your global variable. Also noting that you’ll need to add ‘global $globaluri;’ at the top of each function that needs to reference your global variable.

    Can you supply a link to your site to demonstrate this?

    My test and demo site shows the right links, see My Album!

    Does your theme’s page template that you use NOT use ‘the loop’?
    This might be the cause of your problem, see this topic from the codex.

    Does your theme’s page template that you use NOT use ‘the loop’?
    This might be the cause of your problem, see this topic from the codex.

    Your suggestion goes terribly wrong, since $_SERVER[‘REQUEST_URI’] includes the option arguments. Again see My album and click on ‘View 4 photos’ or the like.
    I made some diagnostic messages there.

    Thread Starter Palamethos

    (@palamethos)

    Hi opajaap

    Thanks for the responses.

    Will look into your suggestions and your album page as well.

    See what you mean about the requested uri, didn’t seem to give me any problems on my test site, but might just not have tested it enough.

    Although there is only one post to show as a page, the page template HAS TO HAVE the so called ‘loop’.

    The basic structure of a template with the loop looks like:

    <?php
    get_header();
    if (have_posts()) :
       while (have_posts()) :
          the_post();
          the_content();
       endwhile;
    endif;
    get_sidebar();
    get_footer();
    ?>

    the_content() renders the the page, including the wppa+ stuff.
    If you use the_content() without the surrounding while loop and/or the_post(), the permalinks are incorrect. In that case you may expect that other things go wrong too.

    This explains your problem.

    For more info see this topic from the codex.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: WP Photo Album Plus] Incorrect page id used in links’ is closed to new replies.