Ultimate WP Query Search Filter
https://wordpress.org/plugins/ultimate-wp-query-search-filter/
Filtered posts
Reply
Ultimate WP Query Search Filter
https://wordpress.org/plugins/ultimate-wp-query-search-filter/
Display posts only with a tag, and sort alphabetical first by tag and then by post.
<?php $tags = get_tags(); foreach ( $tags as $tag ) { $tag_query = new WP_Query( array( 'post_type' => array('links'), 'tag_id' => $tag->term_id, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'no_found_rows' => true, ) ); if( $tag_query->have_posts() ) { echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">'; echo '<h3>' .$tag->name. '</h3>'; echo '</div><!-- .col -->'; } while ( $tag_query->have_posts() ) : $tag_query->the_post(); ?> <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12"><!-- link --> <a href="<?php echo types_render_field("links-url", array("output"=>"raw")); ?>"> <p><?php the_title(); ?> <?php if(types_render_field('links-notes', array('raw'=>'true'))){ ?> <span>(<?php echo types_render_field("links-notes", array("output"=>"HTML")); ?>)</span> <?php } ?> </p> </a> </div><!-- .col --> <?php endwhile; } ?> <?php wp_reset_postdata(); ?>
The output result:
Sortere efter titel.
<?php if(have_posts()): query_posts('post_type=testimonials&orderby=title&order=ASC&posts_per_page=-1'); while(have_posts()): the_post(); ?>
Reference: https://codex.wordpress.org/Class_Reference/WP_Query