WordPress.org

Ready to get started?Download WordPress

Forums

My Post Order
Post order on homepage from get_posts (4 posts)

  1. nat@cry
    Member
    Posted 1 year ago #

    Hi
    First the plugin is just what we need for our new website as other plugins don’t quite work.
    How would I get the odering to happen where do I need to add the section name parameters bit?

    This is my code
    <?php
    $the_query = get_posts( array('category' => 2006 , 'numberposts' => 10 ));
    ?>
    <?php

    foreach( $the_query as $post ) : setup_postdata($post);
    $link = '%s';
    ?>
    <div id="post-<?php the_ID(); ?>" class="milhouse_single_col">
    <?php if ( has_post_thumbnail() ) {
    printf($link,get_the_post_thumbnail(get_the_ID(),'thumbnail'));
    }
    ?>
    <h1><?php printf($link,get_the_title()); ?></h1>
    <p><?php the_excerpt(); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    </p>
    </div>
    <?php
    if ($classPosition=="right") echo "</div>";
    endforeach;

    if ($classPosition=="left") echo "</div>";
    ?>
    Any help much appreciated THanks

    http://wordpress.org/plugins/my-posts-order/

  2. Kapil Chugh
    Member
    Plugin Author

    Posted 11 months ago #

    Sorry for late reply

    You need to put it like this

    <?php
    $the_query = get_posts( array('section_name' => NAME_OF_SECTION' ));
    ?>
  3. nat@cry
    Member
    Posted 11 months ago #

    Hi Kaplin

    Thanks for your reply, I have treid the new code and even created a page to test it on but no luck, all it does is grab the newest posts rather than the order I have created, any ides?

    Your help is very much appreciated

    Thanks Nat

  4. mrzpro
    Member
    Posted 10 months ago #

    Dear Kapil, I' ve the same problem but it' s impossible to show the feed in the home page.
    My "section_name" is "News" and my "NAME_OF_SECTION" is already "News", I have modified your lines but without result.
    There is something wrong can you help me?
    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags