• Is there a way to link to the oldest page, not the oldest post?

    I’m trying to have a button that links to the oldest page, but the url for the oldest page keeps changing (right now it’s paged=18 and tomorrow it’ll be paged=19).

    Right now I have the link in a widget box on the right hand side of my website https://www.stuckstation.com, it says read from the beginning but it only links to the oldest post, not the oldest page.

    Is it even possible?

    And is the inverse possible? Can I make a link to the newest page?

    Thanks for whatever help you can give.

Viewing 5 replies - 1 through 5 (of 5 total)
  • link to oldest ‘page’:

    $max_page = intval($wp_query->max_num_pages);
    echo ' <a class="last" href="'.get_pagenum_link($max_page).'" title="link to oldest paged posts">&raquo; '.$max_page.'</a>';

    link to newest ‘page’:

    echo '<a class="first" href="'.get_pagenum_link(1).'" title="link to newest paged posts">1 &laquo;</a> ';

    Thread Starter cranny777

    (@cranny777)

    ugh sorry that did’t work.

    it looked like this

    Read Stuck Station from the beginning. Stuck Station updates every weekday.
    
    $max_page = intval($wp_query->max_num_pages);
    echo ' <a class="last" href="'.get_pagenum_link($max_page).'" title="link to oldest paged posts">&raquo; '.$max_page.'</a>';

    this is php code and needs to be added within php tags.

    Thread Starter cranny777

    (@cranny777)

    … i’m sorry man. i’m not sure what that means.

    please forgive me i’m still new at this.

    php tags are these <?php .... ?> that tell the server to do something with what is inbetween the tags.

    <?php $max_page = intval($wp_query->max_num_pages);
    echo ' <a class="last" href="'.get_pagenum_link($max_page).'" title="link to oldest paged posts">&raquo; oldest page</a>'; ?>

    <?php echo '<a class="first" href="'.get_pagenum_link(1).'" title="link to newest paged posts">newest page &laquo;</a> '; ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘linking to oldest page and newest page’ is closed to new replies.