Created
October 6, 2019 20:50
-
-
Save devinsays/cacbd1bd49e9b6cbdd02329f799ddc12 to your computer and use it in GitHub Desktop.
Customized example of the Image Gallery Formats template for Portfolio Press.
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 | |
/** | |
* Template Name: Image and Gallery Posts | |
* Descriptions: Displays all image and gallery post formats. | |
* | |
* @package Portfolio Press | |
*/ | |
get_header(); ?> | |
<?php | |
if ( get_query_var( 'paged' ) ) { | |
$paged = get_query_var( 'paged' ); | |
} elseif ( get_query_var( 'page' ) ) { | |
$paged = get_query_var( 'page' ); | |
} else { | |
$paged = 1; | |
} | |
$args = array( | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'post_format', | |
'field' => 'slug', | |
'terms' => array( 'post-format-image', 'post-format-gallery' ), | |
) | |
), | |
'paged' => $paged | |
); | |
$portfolio = new WP_Query( $args ); | |
?> | |
<div id="primary"> | |
<div id="content" role="main"> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<?php the_content(); ?> | |
<?php endwhile; ?> | |
<?php if ( $portfolio->have_posts() ) : ?> | |
<?php /* Start the Loop */ ?> | |
<?php while ( $portfolio->have_posts() ) : $portfolio->the_post(); ?> | |
<?php get_template_part( 'content', 'portfolio' ); ?> | |
<?php endwhile; ?> | |
<?php portfoliopress_paging_nav( $portfolio ); ?> | |
<?php else : ?> | |
<?php get_template_part( 'content', 'none' ); ?> | |
<?php endif; ?> | |
</div><!-- #content --> | |
</div><!-- #primary --> | |
<?php wp_reset_query(); ?> | |
<?php if ( ! portfoliopress_get_option( 'portfolio_sidebar', false ) ) { get_sidebar(); } ?> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment