Files
ycb.vn/archive-portfolio.php
T
Thuan Bui c5865ef889 Init
2017-10-05 10:05:14 +07:00

96 lines
2.5 KiB
PHP

<?php
/**
* Portfolio Archive.
*
* This template overrides the default archive template to clean
* up the output.
*
* @package Business Pro
* @link https://seothemes.com/business-pro
* @author Seo Themes
* @copyright Copyright © 2017 Seo Themes
* @license GPL-2.0+
*/
// Force full width content layout.
add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' );
// Remove the breadcrumbs.
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
// Remove standard loop (optional).
remove_action( 'genesis_loop', 'genesis_do_loop' );
// Add our custom loop.
add_action( 'genesis_loop', 'business_filterable_portfolio' );
// Enqueue scripts.
wp_enqueue_script( 'isotope', get_stylesheet_directory_uri() . '/assets/scripts/min/isotope.pkgd.min.js', array( 'jquery' ), CHILD_THEME_VERSION, false );
wp_enqueue_script( 'isotope-init', get_stylesheet_directory_uri() . '/assets/scripts/min/isotope-init.min.js', array( 'isotope' ), CHILD_THEME_VERSION, false );
/**
* Output filterable portfolio items.
*
* @since 1.0.0
*
* @return void
*/
function business_filterable_portfolio() {
global $post;
$terms = get_terms( 'portfolio-type' );
?>
<div class="portfolio">
<?php if ( $terms ) { ?>
<div id="portfolio-cats" class="filter clearfix">
<div class="wrap">
<a href="#" class="active" data-filter="*"><?php esc_html_e( 'All', 'business-pro' ); ?></a>
<?php foreach ( $terms as $term ) : ?>
<a href='#' data-filter='.<?php echo esc_attr( $term->slug ); ?>'><?php echo esc_html( $term->name ); ?></a>
<?php endforeach; ?>
</div>
</div>
<?php } ?>
<?php if ( have_posts() ) { ?>
<div class="portfolio-sizer"></div>
<div class="portfolio-content">
<?php
while ( have_posts() ) :
the_post();
$terms = get_the_terms( get_the_ID(), 'portfolio-type' );
// Display portfolio items.
if ( has_post_thumbnail( $post->ID ) ) {
?>
<article class="portfolio-item <?php if ( $terms ) { foreach ( $terms as $term ) { echo ' ' . esc_attr( $term->slug ); } } ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php
echo genesis_get_image( array(
'size' => 'portfolio',
'itemprop' => 'image',
) );
printf( '<p class="entry-title" itemprop="name"><span>%s</span></p>', get_the_title() );
?>
</a>
</article>
<?php
}
endwhile;
?>
</div>
<?php } ?>
</div>
<?php
}
// Run genesis.
genesis();