Last active
December 10, 2015 00:59
WP_Query for Celia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $args = array ( | |
| 'post_type' => 'books', | |
| 'showposts' => 3, // change this to how many books you want to show, set to -1 to display all that meet these criteria | |
| 'tax_query' => array( | |
| 'taxonomy' => 'genre', | |
| 'field' => 'slug', | |
| 'terms' => 'allbooks') //category slug | |
| ); | |
| $query = new WP_Query($args); ?> | |
| <ul> | |
| <?php while( $query->have_posts() ): $query->the_post(); ?> | |
| <li>if ( get_post_meta($post->ID, 'ftimg', true) ) { ?> | |
| <a href="<?php the_permalink() ?>"><img src="<?php echo get_post_meta($post->ID, 'ftimg', true) ?>" alt="<?php the_title(); ?> by Celia Kyle Paranormal Romance Author" | |
| title="<?php the_title(); ?> by Celia Kyle Paranormal Romance Author" /></a> <?php } //close if statement | |
| ?> </li> | |
| <?php endwhile; wp_reset_postdata();?> | |
| </ul> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment