Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Some info:
- * http://wordpress.stackexchange.com/questions/13888/retrieve-single-term-slug
- * http://codex.wordpress.org/Function_Reference/WP_Query#Taxonomy_Parameters
- */
- $term_slug = get_queried_object()->slug;
- if ( !$term_slug )
- return;
- else
- $args = array(
- 'tax_query' => array(
- array(
- 'post_type' => 'gallery',
- 'taxonomy' => 'gallery_category',
- 'field' => 'slug',
- 'terms' => $term_slug
- )
- ),
- 'posts_per_page' => 3,
- 'paged' => get_query_var( 'paged' )
- );
- $loop = new WP_Query( $args );
- while ( $loop->have_posts() ) : $loop->the_post(); ?>
- <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
- <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'poznaj-wilno' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
- <div class="entry-thumbnail">
- <?php if ( has_post_thumbnail() ) : ?>
- <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'poznaj-wilno' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail( 'gallery-thumbnail' ); ?></a>
- <?php endif; ?>
- </div><!-- .entry-thumbnail -->
- </div><!-- #post-## -->
- <?php endwhile; // End the loop. Whew.
- /*Using WP-PageNavi plugin.
- * Call based on - http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html
- */ ?>
- <div class="pagination">
- <?php
- if ( function_exists('wp_pagenavi') )
- wp_pagenavi( array( 'query' => $loop ) );
- ?>
- </div><!-- .pagination -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement