• i have a link on the homepage that goes to a page that i create monthly. each month a new page is created – and when you visit that page – it uses wp_list_pages to show all the previous month’s pages (like an archive).

    I want to have this link on the homepage always link to the most current page posted. but i have to keep changing the HTML link each time i post a new page.

    is there any way to call only the most currently posted page? i tried using wp_list_pages but could not get it work because it calls all pages.

    thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Did you ever figure this one out? I am having this problem also, but on a daily basis.

    Thanks

    i am also looking for this solution..
    and exactly what dilhuett is looking for

    <?php
    wp_list_pages('sort_column=post_date&sort_order=DESC&number=1');
    ?>

    or

    <?php
      $args=array(
        'post_type' => 'page',
        'post_status' => 'publish',
        'orderby' => 'date',
        'order' => 'DESC',
        'showposts' => 1,
        'caller_get_posts'=> 1
        );
      $my_query = null;
      $my_query = new WP_Query($args);
      if( $my_query->have_posts() ) {
        echo 'List of: ' . $type .'(s)';
        while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
         <?php
        endwhile;
      } //if ($my_query)
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘link to most current page’ is closed to new replies.