• Hello all,

    Looking for some question advice here. Currently, have my posts being pulled from my blog to display externally but, it’s not displaying them from the most recent date (July) only from (May)

    <?php
    require(‘blog/wp-blog-header.php’);
    ?>

    <?php
    $posts = get_posts(‘numberposts=5&order=ASC&orderby=post_title’);
    foreach ($posts as $post) : setup_postdata( $post ); ?>
    <?php the_date(); echo “
    “; ?>
    <?php the_title(); ?>
    <?php the_excerpt(); ?>
    <?php
    endforeach;
    ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • right now, your query is sorting by post title and limited to 5 posts –

    is that intended?

    review: http://codex.ww.wp.xz.cn/Template_Tags/get_posts

    Thread Starter CherryDesigns

    (@cherrydesigns)

    Yes, I intended only to have 5 posts.. but id like it in date order

    SO i’m guessing its just adding the “‘orderby’ => ‘post_date’,” in

    Thread Starter CherryDesigns

    (@cherrydesigns)

    <?php
    $posts = get_posts(‘numberposts=5&order=ASC&orderby=post_date’);
    foreach ($posts as $post) : setup_postdata( $post ); ?>
    <?php the_date(); echo “
    “; ?>
    <?php the_title(); ?>
    <?php the_excerpt(); ?>
    <?php
    endforeach;
    ?>

    Changed to this but no different..

    if you want to see the latest 5 posts, change ASC to DESC or remove it as DESC is the default;

    $posts = get_posts('numberposts=5');
    Thread Starter CherryDesigns

    (@cherrydesigns)

    Thank you – been working loverly for a week now.. until

    Warning: Cannot modify header information - headers already sent by (output started at /home/cherryde/public_html/index.php:274) in /home/cherryde/public_html/blog/wp-content/plugins/wpclef/includes/lib/wp-session/class-wp-session.php on line 124

    Any suggestions?

    Thread Starter CherryDesigns

    (@cherrydesigns)

    Fixed, disabled the clef plugin

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘External Post Display’ is closed to new replies.