WordPress.org

Ready to get started?Download WordPress

Forums

Miniposts
Sorting miniposts by date (4 posts)

  1. rosiegant
    Member
    Posted 3 years ago #

    Hi

    Does anyone know if its possible to sort Miniposts by publication date, showing the oldest post first?

    Many thanks.

    http://wordpress.org/extend/plugins/miniposts/

  2. MichaelH
    Member
    Posted 3 years ago #

    Didn't test this but:

    <?php
    $args=array(
      'meta_key' => '_mini_post',
      'order' => 'ASC',
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo 'List of mini posts';
      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;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
  3. rosiegant
    Member
    Posted 3 years ago #

    Hi - thank you so much for that. I'm afraid my php is a bit limited. I tried adding it but created a fatal error. Is there a particular place in the code it needs to go in? I couldn't see anything about a sort order but I may well have missed it.

  4. MichaelH
    Member
    Posted 3 years ago #

    The 'order' clause does the sorting.

    Consider downloading and installing Otto's PHP Code Widget, then put that code in one of those widgets.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags