Title: [Plugin: My Post Order] Sorting for sidebar
Last modified: August 20, 2016

---

# [Plugin: My Post Order] Sorting for sidebar

 *  [igor123](https://wordpress.org/support/users/igor123/)
 * (@igor123)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/)
 * Hi Kapil Chugh,
 * first of all thank you for this awesome plugin!
 * It works great.
    I insered <?php query_posts(‘section_name=SECTION_NAME’) ?> 
   in my template and everything is fine.
 * I have a question about using this ordering for the related links in my sidebar.
   My sidebar is also integrated in the Theme. So I don’t use the widgets and need
   how to sort them there too.
 * Can I put there a code into too to order these related links of the same categorie?
 * Thank you very much
 * My Sidebar-Code is:
    <div class=”right”> <div class=”widget_recent_entries”> 
   <h2 class=”widgettitle”>Recent Articles</h2>
    -  <?php
       global $post; $args = array( ‘numberposts’ => 10, ‘offset’=> 1, ‘category’
      => 8 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata(
      $post); ?>
    - 
    -  <?php endforeach; ?>
 *  </div>
 *  </div>
 * [http://wordpress.org/extend/plugins/my-posts-order/](http://wordpress.org/extend/plugins/my-posts-order/)

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

 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/#post-3008307)
 * Hi,
 * Thank you so much.
 * As far as related links are concerend, we normally display other posts in the
   same category. I don’t think you can do with this plugin.
 * But if you want to display some featured posts category wise, then you can create
   multple sections by assigning section name same as category name and pass those
   names in query_posts like this
 * `<?php query_posts('section_name=cat1') ?>`
 *  Thread Starter [igor123](https://wordpress.org/support/users/igor123/)
 * (@igor123)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/#post-3008432)
 * Thank you Kapil for your response!
 * Did I understand it right, it is not possible to order the article links from
   the same section on the sidebar?
    You can only sort the articles but not the 
   related article links for the sidebar on the same section/category?
 * Thanks a lot 🙂
 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/#post-3008435)
 * Now you have created doubt in my mind 🙂
 * It would be great if you could please expain your problem(specially related links)
   again in detail along with your site URL(if you can share)
 * Sorry for inconvenience.
 *  Thread Starter [igor123](https://wordpress.org/support/users/igor123/)
 * (@igor123)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/#post-3008454)
 * Thank you I really appreciate your help 🙂
 * You can find a picture with details of my problem here:
    [http://www.abload.de/img/mypostorderinfzz.jpg](http://www.abload.de/img/mypostorderinfzz.jpg)
 * The articles on the left side are already working with your my post order plugin
   by adding <?php query_posts(‘section_name=Offers’) ?> before the code <?php if(
   have_posts() ) : ?>.
 * Now my problem:
    I want that these Articles, on the left side in the content 
   area, should also show up on the right side, next to the articles, but not the
   whole post, only the links to the articles of this section.
 * I hope I could explain it a bit better now, if not I can try to give more info
   🙂
 * Thank you so much again Kapil
 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/#post-3008455)
 * Pleasure is always mine 🙂
 * In RHS you need to do the same thing. For eg.
 *     ```
       <ul>
          <?php
       									global $post;
       									$args = array( 'section_name' => 'Offers' );
       									$myposts = get_posts( $args );
       									foreach( $myposts as $post ) :	setup_postdata($post); ?>
       <li><a><?php the_title(); ?></a></li>
       								<?php endforeach; ?>
       </ul>
       ```
   
 * Feel free to revert back.
 *  Thread Starter [igor123](https://wordpress.org/support/users/igor123/)
 * (@igor123)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/#post-3008466)
 * Thank you Kapil!
 * If I’m changing your suggestion:
 *  **$args = array( ‘numberposts’ => 10, ‘offset’=> 1, ‘category’ => 8 );**
    to**
   $args = array( ‘section_name’ => ‘Offers’ );**
 * it just displays ALL the latest created Posts in wordpress, no matter what category/
   section I’m using for section_name. Sadly it doesn’t take the section-posts.
 * Do you know what the problem is?
 * Thank you
 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/#post-3008469)
 * So there must be 2 loops on your page. One on the LHS on main content area and
   2nd in the sidebar.
 * Ideally speaking, it should work now.
 * Have you put `wp_reset_query();` after your loop.
 *  Thread Starter [igor123](https://wordpress.org/support/users/igor123/)
 * (@igor123)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/#post-3008503)
 * Sorry for the late response.
 * How should I put 2 loops on the page. I have at the moment one file called loop.
   php with the content:
    -  <?php
       while ($the_query->have_posts()) : $the_query->the_post(); ?>
    -  <span class=”mpo_post_title”>
       ” title=”<?php echo esc_attr(get_the_title()?
      get_the_title() : get_the_ID()); ?>”> <?php if ( get_the_title() ) the_title();
      else the_ID(); ?>  </span>
    -  <?php
       endwhile; ?>
 * Where should I put wp_reset_query(); ?
 * Thank you again 🙂
 *  Plugin Author [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * (@kapilchugh)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/#post-3008506)
 * No, you need to put wp_reset_query in your theme after while loop.
 * Or
 * You can send me your index.php and sidebar.php file. I’ll check it.

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

The topic ‘[Plugin: My Post Order] Sorting for sidebar’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/my-posts-order_8e9dad.svg)
 * [My Post Order](https://wordpress.org/plugins/my-posts-order/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/my-posts-order/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/my-posts-order/)
 * [Active Topics](https://wordpress.org/support/plugin/my-posts-order/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/my-posts-order/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/my-posts-order/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Kapil Chugh](https://wordpress.org/support/users/kapilchugh/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-my-post-order-sorting-for-sidebar/#post-3008506)
 * Status: not resolved