• Why does is_paged not seem to apply to my first page of search results when there IS a “next page” link (for older search results) being generated? Seems to me like it really is paged, just not in both directions.

Viewing 12 replies - 1 through 12 (of 12 total)
  • it is paged, and you can verify that by putting this:

    <?php if(is_paged) {echo "paged"; } ?>

    at the bottom of any template file to doublecheck.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    “Paged” means everything but the first page. Only 2nd pages and onward are “paged”.

    Thread Starter RobLifford

    (@roblifford)

    Oh, weird — I was testing it almost the same way and it wasn’t working. I guess it was just syntax. I was using this:

    <?php if(is_paged() ) {
    echo(‘<h2>Test! This is paginated!</h2>’);
    } ?>

    So I guess those extra parentheses were messing things up. Thanks.

    Thread Starter RobLifford

    (@roblifford)

    Hmmm. Actually, I just noticed that the test code is showing up on search results or monthly archives that, at least from my perspective, aren’t paged… like if there’s only 3 posts to display and my max per page is 10. Am I still missing the concept? Does is_paged apply to things that _could be_ paged even if they aren’t?

    My test code is exactly what whoomi provided above.

    Well, I originally was going to respond as Otto did but decided to test it on my own site.. which i why I provided that, since that what I used to test ??

    My own site behaved as you have indicated — the first page is, indeed, ‘is_paged’.

    In fact, I even tested this scenario:

    https://www.xxx.org/archives/xxx/xxx/

    vs.

    https://www.xxx.org/archives/xxx/xxx/page/1/

    and they both show up as paged.

    I’ve edited those links, I really dont want my site spidered like that.

    I got askimeted , Ive replied..

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Hmmm.. I didn’t think that was the case. Weird.

    Is paged also set on single post pages (ones without the page tag, obviously) ? If so, then it’s a bug and I may know the reason.

    Thread Starter RobLifford

    (@roblifford)

    Otto42: yep, even on my single.php template, this code…

    <?php if(is_paged) echo "Paged!"; ?>

    …*does* output Paged! in the HTML. Bug?

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Probably. I need to setup a test site and see if I can figure out why it does that. I don’t think it’s supposed to.

    i’ve noticed that obviously there’s a difference between is_paged and is_paged() (at least in wp 2.2), betwwen the variable and the function. you have to try out to find the right one for you, because i can’t explain it ??

    I haven’t tested this, but I’m guessing if(is_paged) is actually asking PHP “Is there a function called is_paged?” and PHP is saying “Yep, there’s a function called is_paged“.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Oh! Hah, yeah, Jeremy is correct, I never noticed that.

    The code *should* be if (is_paged())... like all those tags. If you leave those off, it’s checking for existence of the function.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘confusion around is_paged’ is closed to new replies.