WordPress.org

Ready to get started?Download WordPress

Forums

<!--netxpage--> and conditional tags (10 posts)

  1. LiZharD
    Member
    Posted 8 years ago #

    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

  2. You need to use this code. ;)

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

  3. LiZharD
    Member
    Posted 8 years ago #

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

  4. 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.

  5. LiZharD
    Member
    Posted 8 years ago #

    Nothing..
    $paged doesn't work..

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

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

    But there's gonna be a var...

  7. LiZharD
    Member
    Posted 8 years ago #

    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...

  8. 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.

  9. jalenack
    Member
    Posted 8 years ago #

    $_GET['paged'] .. Fin.

  10. Ha, almost had it! lol

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags