don't display if empty sort alfabetical
-
I am really not a programmer but got this far by searching the forum.
I am using the Types plugin, to create custom post types and custom fields.
Three things I would like to do:
– don’t display tag if it’s empty
– sort the posts alfabetical
– if custom field “links-notes” is empty don’t display<?php $tags = get_tags(); foreach ( $tags as $tag ) { echo '<div class="row">'; echo '<h3>' .$tag->name. '</h3>'; $tag_query = new WP_Query( array( 'post_type' => array('links'), 'tag_id' => $tag->term_id, 'posts_per_page' => -1, 'no_found_rows' => true, ) ); while ( $tag_query->have_posts() ) : $tag_query->the_post(); ?> <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12"> <p><a href="<?php echo types_render_field("links-url", array("output"=>"raw")); ?>"><?php the_title(); ?></a> (<?php echo types_render_field("links-notes", array("output"=>"HTML")); ?>)</p> </div><!-- .col --> <?php endwhile; echo '</div><!-- .row -->'; wp_reset_postdata(); } ?>
Please remember that I am not a programmer so please be very specific ??
Any help is very much appreciated!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘don't display if empty sort alfabetical’ is closed to new replies.