WordPress.org

Ready to get started?Download WordPress

Forums

My Post Order
Sorting for sidebar (10 posts)

  1. igor123
    Member
    Posted 1 year ago #

    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 the_title(); ?>
    • <?php endforeach; ?>

    </div>

    </div>

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

  2. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    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') ?>

  3. igor123
    Member
    Posted 1 year ago #

    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 :)

  4. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. igor123
    Member
    Posted 1 year ago #

    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

    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

  6. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  7. igor123
    Member
    Posted 1 year ago #

    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

  8. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  9. igor123
    Member
    Posted 1 year ago #

    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:

    Where should I put wp_reset_query(); ?

    Thank you again :)

  10. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.