WordPress.org

Support

Support » How-To and Troubleshooting » <!–netxpage–> and conditional tags

<!–netxpage–> and conditional tags

  • LiZharD
    Member

    @lizhard

    Hi,
    i’m triyng to build a dynamic sidebar using conditional tags:
    <?php if(is_page('24')): ?> /* i'm on the page with ID 24, then print something */
    but if my post is splitted with <!–nextpage–> in the second page i want print out something else. I don’t know how check this. I’ve tried with;
    <?php if(is_page('24') && $page=2) : ?>
    but don’t works for me.

    Any ideas?
    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Alex Mills (Viper007Bond)
    Participant

    @viper007bond

    You need to use this code. 😉

    <?php if(is_page('24') && $_GET['page'] == 2) : ?>

    LiZharD
    Member

    @lizhard

    Hi Viper,
    your code don’t works…
    Currently mod_rewrite is on and permalinks appears like this:
    /page-slug/2/

    Alex Mills (Viper007Bond)
    Participant

    @viper007bond

    Yes, but mod_rewrites it to an index.php based URL behind the scenes. 😉

    However, in the case of post/page permalinks, the whole string is given to WordPress to handle, so yeah, $_GET doesn’t work with permalinks.

    Hmm. Try $paged for the hell of it.

    If that doesn’t work, it may be time to rip apart the core files to see if a variable is set because I don’t know of any conditional tags that can handle this.

    LiZharD
    Member

    @lizhard

    Nothing..
    $paged doesn’t work..

    It is possible that there is no tags to check if the post is splitted?

    Alex Mills (Viper007Bond)
    Participant

    @viper007bond

    There are no conditional for that that I see: http://codex.wordpress.org/Conditional_Tags

    But there’s gonna be a var…

    LiZharD
    Member

    @lizhard

    The var page=2 is useful but unusable with mod_rewrite on and permalinks…
    At this point i don’t know what i have to do…

    Alex Mills (Viper007Bond)
    Participant

    @viper007bond

    Actually, I believe it still gets set behind the scenes, but only when doing like category/page/2, not post/Page pages.

    Sounds like it’s time to rip apart the core files.

    jalenack
    Member

    @jalenack

    $_GET[‘paged’] .. Fin.

    Alex Mills (Viper007Bond)
    Participant

    @viper007bond

    Ha, almost had it! lol

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘<!–netxpage–> and conditional tags’ is closed to new replies.