Page Shortcode (2 posts)

  1. mythusmage
    Posted 5 years ago #

    I would like to produce a ToC for my blog, where are the guidelines hiding? I can find general guidelines, and the article an the shortcode API, but nothing on the page shortcode. Or has that particular short code been depracated?

  2. MichaelH
    Posted 5 years ago #

    Not sure what you are asking so this will list all pages and then all posts

    $types[0] = 'page';
    $types[1] = 'post';
    foreach ($types as $type) {
        'post_type' => $type,
        'post_status' => 'publish',
        '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>
      } //if ($my_query)
    } // foreach
    wp_reset_query();  // Restore global post data stomped by the_post().

Topic Closed

This topic has been closed to new replies.

About this Topic