Support » Fixing WordPress » Check Which Post Page am I

  • Resolved gusleig

    (@gusleig)


    Hi,

    I´m using wp_link_pages within some of my posts, and I don´t want to display Ads from 2nd page beyond.

    How can I check that I´m not in the 1st post page?

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • in posts/pages broken up using <!--nextpage-->, there are two global variables holding the information for paged posts or pages:

    $page
    is the page number you are on;

    $numpages
    is the total nuber of pages.

    this should work:

    <?php if( $page <= 1) { ?>
    YOUR AD CODE HERE
    <?php } ?>

    Alchymyth,

    sweet, worked PERFECTLY! Now my visitors only see ads in Page 1.

    Just for reference and others tha might be interested,
    do you know any WordPress manual page with this?

    thank you!

    do you know any WordPress manual page with this?

    no

    I tend to follow any functions into the core codes;

    – starting with the full list of WordPress functions: http://phpxref.ftwr.co.uk/wordpress/nav.html?_functions/index.html

    – then click on the link of the function in question;

    – then click the link beow ‘Defined at:’

    that will usually show you the core code where the function is defined;

    – then follow any sub-functions (they highlight on hover and link to their respective code section) until you have found what you are after (or until you give up).

    That is great and I think it´s a good tip.

    thanks again

    case closed!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Check Which Post Page am I’ is closed to new replies.