• Resolved Frank Z.

    (@frank-z)


    I’ve tried everything I can think of to track this problem down, but am truly stuck. I’m using the <!–nextpage–> tag in pages and posts. Somewhere along the way the first page began to always be formatted as an a-link, even if I’m on that page. I can’t get it to change.

    I tried de-activating all my plugins, one by one. I also tried setting up a new wordpress site on a temporary subdomain with the same template and same stylesheet (which worked properly). I then added all the plugins I use on the problem site. It still works fine on the temporary site, but not on the actual one.

    You can view the problem here: https://www.practicaprophetica.com/articles/carnal-warfare-not-in-gods-plan

    And here is the temporary site, with the same article (it’s on the front page): https://test.practicatechnical.com/

    Same template (although there are a few modifications on the actual site), same stylesheet, same plugins. What could it be?

    I’m guessing the problem is happening in the wp_link_pages() call, that it is somehow not recognizing the first page as the home page for that article. It’s not just this one article, but any page or post that uses nextpage…all have the same problem.

    Can anyone suggest where I should look to solve this, or what could be causing it? I’ve programmed before, although I don’t know PHP much. But with a few tips, I can work my way through the code. I just need some suggestions because I’ve run out of ideas.

Viewing 4 replies - 1 through 4 (of 4 total)
  • the ‘nextpage’ links don’t seem to be from the theme, but might be from a plugin?

    Thread Starter Frank Z.

    (@frank-z)

    The “Single” page addition on the end of the pagination list is coming from Page-Links Plus, but the rest is from the template. This is from page.php:

    <div class=”entry”>
    <?php global $more; $more=0; the_content(‘<p class=”serif”>Read the rest of this page »</p>’); ?>
    <?php wp_link_pages(array(‘before’ => ‘<div class=”page-links”>’ . __(‘Pages:‘), ‘after’ => ‘</div>’)); ?>
    </div>

    single.php has similar code. I actually updated the line with wp_link_pages from the 2012 theme, but the old code was very similar. Both did not work properly with this site, but all works fine on my test site (https://test.practicatechnical.com)…same theme. I tested it also before adding any plugins, and it worked. So the paging code is okay.

    I’m sure the problem is not with the theme (it’s the KIS – keep it simple theme from css mayo (https://www.ads-software.com/extend/themes/kis-keep-it-simple), otherwise why would it work on the test site?

    Now it is possible that a plugin has affected the pageID or something…but again, it works fine on the test site, however, there is only one page on that site! So perhaps with all the pages and things going on, something is messing with the pageID or code in the database. If you can suggest how to test this, I’ll give it a try.

    is there a reason why you have added global $more; $more=0; to this line:

    <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>

    (as in https://codex.www.ads-software.com/Customizing_the_Read_More#How_to_use_Read_More_in_Pages )

    is that the same in both sites?

    what happens if you temporarily deactivate all plugins other than the ‘page-links plus’?

    Thread Starter Frank Z.

    (@frank-z)

    Eureka!! You hit it! It’s this part of the code:

    global $more; $more=0;

    The reason why my test site was working is that I must have downloaded a slightly newer version of the template that did not have this code in it. Once I remove those two declarations, it all works!!

    For now I’m just stripping out those declarations, as I don’t use the “more” feature. I took a look at the docs you linked to, and I guess if I ever need it I can follow that guideline to put it back in (the proper way).

    Many thanks for your help. After losing a whole night of sleep on this, you’ll have to excuse me while I do a dance in the middle of the floor….! ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Strange problem with pagination (nextpage)’ is closed to new replies.