Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: Portfolio Page
- *
- * @package Theme Palace
- * @subpackage Kids Education Pro
- * @since Kids Education Pro 1.0
- */
- get_header();
- $options = kids_education_pro_get_theme_options(); // get theme options
- $portfolio_ids = !empty( $options['portfolio_category'] ) ? $options['portfolio_category'] : array();
- ?>
- <section id="portfolio-gallery" class="page-section os-animation" data-os-animation="fadeIn">
- <div class="container">
- <div class="entry-content">
- <?php if( !empty( $portfolio_ids ) ){ ?>
- <nav class="portfolio-filter">
- <ul>
- <li class="active"><a href="#" data-filter="*"><?php esc_html_e( 'Filter all', 'kids-education-pro' ); ?></a></li>
- <?php foreach ($portfolio_ids as $key => $portfolio_id ) {
- $tp_category = get_category( $portfolio_id );
- echo '<li><a href="#" data-filter=".' . esc_attr( $tp_category->slug ) . '">' . esc_html( $tp_category->name ) . '</a></li>';
- }
- ?>
- </ul>
- </nav><!-- .portfolio-filter -->
- <?php }
- if( !empty( $portfolio_ids ) ){
- $posts_per_page = 15;//get_option( 'posts_per_page', 15 ); // get posts per page from reading option
- $args = array(
- 'category__in' => $portfolio_ids,
- 'post_type' => 'post',
- 'posts_per_page' => $posts_per_page,
- );
- $portfolio_posts = get_posts( $args );
- ?>
- <div id="four-col" class="portfolio-wrapper">
- <?php
- foreach ( $portfolio_posts as $key => $portfolio_post ) {
- $portfolio_post_id = $portfolio_post->ID; // get post id
- $portfolio_categories = get_the_category( $portfolio_post_id ); // get post categories
- $term_slug = '';
- foreach ($portfolio_categories as $key => $portfolio_category) {
- $term_slug .= $portfolio_category->slug . ' ';
- }
- ?>
- <div class="portfolio-item activities <?php echo esc_attr( $term_slug ); ?>">
- <div class="image-wrapper">
- <?php if( has_post_thumbnail( $portfolio_post_id ) ){
- $img_array = wp_get_attachment_image_src( get_post_thumbnail_id( $portfolio_post_id ), 'kids-education-pro-gallery-section-small' );
- $img_array_large = wp_get_attachment_image_src( get_post_thumbnail_id( $portfolio_post_id ), 'large' );
- } else {
- $img_array[0] = get_template_directory_uri().'/assets/uploads/no-featured-image-300x300.png';
- $img_array_large[0] = get_template_directory_uri().'/assets/uploads/no-featured-image-625x400.png';
- } ?>
- <img src="<?php echo esc_url( $img_array[0] ); ?>" alt="<?php echo esc_html( get_the_title( $portfolio_post_id ) ); ?>">
- <div class="blue-overlay"></div>
- </div><!-- .image-wrapper -->
- <div class="hovercontent">
- <a data-title="Gallery" href="<?php echo esc_url( $img_array_large[0] ) ?>" data-lightbox="masonry"><i class="fa fa-search"></i></a>
- <a href="<?php echo esc_url( get_permalink( $portfolio_post_id ) );?>"><i class="fa fa-link"></i></a>
- <p><a href="<?php echo esc_url( get_permalink( $portfolio_post_id ) );?>"><?php echo esc_html( get_the_title( $portfolio_post_id ) );?></a></p>
- </div><!-- end .hover-content -->
- </div><!-- end .portfolio-item -->
- <?php }?>
- </div><!-- end portfolio -->
- <?php } ?>
- <div class="text-center">
- <a href="#" id="loadmore" class="btn btn-blue"><?php esc_html_e( 'Load more', 'kids-education-pro' ) ?></a>
- </div><!-- end .button -->
- </div><!-- end .entry-content -->
- </div><!-- end .container -->
- </section><!-- #portfolio-gallery -->
- <?php
- get_footer();
Advertisement
Add Comment
Please, Sign In to add comment