WordPress.org

Ready to get started?Download WordPress

Forums

My Post Order
Can't order my posts (2 posts)

  1. Mirizarry
    Member
    Posted 1 year ago #

    Hi,

    For some reason I can not get this to work on my site. Here's my code below, can someone tell me if I'm doing something incorrectly? I don't have any other post/page ordering plugins installed.

    Thanks in Advance!

    <?php
    				$wpquery = new WP_Query( array(
    					'section_name' => 'staff_reorder',
    					'category_name' => 'staff'
    					));
    
    				?>
    
    				<?php if ($wpquery->have_posts()) : ?>
    				<?php while ($wpquery->have_posts()) : $wpquery->the_post(); ?>
    
    <div class="staff-member">
    		<div class="staff-photo">
    		<a href="<?php the_permalink(); ?>"><img src="<?php echo get_field('staff_portrait'); ?>" /></a>
    		</div>
    
    		<div class="staff-name"><?php echo get_field('staff_name'); ?></div>
    		<div class="staff-title"><?php echo get_field('staff_title'); ?></div>
    </div> <!-- close staff member -->
    
    	<?php endwhile; ?>
    <?php else : ?>
    <?php endif; ?>

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

  2. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    There is no need to add 'category_name' => 'staff'. You can keep it simple like this :
    $wpquery = new WP_Query( array('section_name' => 'staff_reorder'));

    and select posts from that category while creating section.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.