WordPress.org

Forums

Visitor can choose post sorting (1 post)

  1. alexislevrai
    Member
    Posted 3 years ago #

    Hi everyone,

    So, I would like my visitors can choose to sort the posts by date descending or title ascending when he click on a simple link "Date" or "A-Z".

    But i've got two different post design ...
    Like this for "By Date"

    <?php if(have_posts()) : ?>
    		<?php while(have_posts()) : the_post(); ?>
    		<div class="ContentTrack" id="Track-<?php the_ID(); ?>">
    			 <a href="<?php the_permalink(); ?>">
    				<?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a>
    		</div>
    		<?php endwhile; ?>
    			<?php posts_nav_link(' - ','page suivante','page précédente'); ?>
    		<?php else : ?>
    		<?php endif; ?>

    And like this for "By Title"

    [Code moderated as per the Forum Rules. Please use the pastebin]

    It's very similar, just adding a letter for each group when is sort by alphabetical.
    I have no idea how I can do this "selector" ? Can someone help me? Guide me?

    Thanks you very much for everything.

Topic Closed

This topic has been closed to new replies.

About this Topic