Untitled diff
56 removals
77 lines
51 additions
73 lines
<?php
<?php
/**
/**
* Showcase Pro
* Showcase Pro
*
*
* This file adds the entry grid shortcode to the Showcase Pro Theme.
* This file adds the entry grid shortcode to the Showcase Pro Theme.
*
*
* @package Showcase
* @package Showcase
* @author Bloom
* @author Bloom
* @license GPL-2.0+
* @license GPL-2.0+
* @link http://my.studiopress.com/themes/showcase/
* @link http://my.studiopress.com/themes/showcase/
*/
*/
// Add Entry Grid Shortcode
// Add Entry Grid Shortcode
add_shortcode( 'entry-grid', 'showcase_entry_grid_shortcode' );
add_shortcode( 'entry-grid', 'showcase_entry_grid_shortcode' );
function showcase_entry_grid_shortcode( $atts ) {
function showcase_entry_grid_shortcode( $atts ) {
global $post;
extract( shortcode_atts( array(
'limit' => -1,
'category' => '',
'name' => '',
'type' => 'page',
'id' => $post->ID
), $atts ) );
$args = array(
extract( shortcode_atts( array(
'post_type' => $type,
'limit' => -1,
'post_parent' => ($type == 'post') ? '' : $id,
'category' => '',
'posts_per_page' => $limit,
'name' => '',
'category_name' => $category,
'type' => 'page',
'order' => 'ASC',
'id' => get_the_ID(),
'orderby' => 'menu_order',
), $atts ) );
'paged' => get_query_var( 'paged' )
);
global $wp_query;
$args = array(
'post_type' => $type,
'post_parent' => ($type === 'post') ? '' : $id,
'posts_per_page' => $limit,
'category_name' => $category,
'order' => 'ASC',
'orderby' => 'menu_order',
'paged' => get_query_var( 'paged' ),
);
$loop = new WP_Query( $args );
$loop = new WP_Query( $args );
ob_start();
ob_start();
$i = 0;
$i = 0;
while ( $loop->have_posts() ) {
while ( $loop->have_posts() ) {
$loop->the_post();
$loop->the_post();
$classes = ($i % 4 == 0) ? 'one-fourth first' : ' one-fourth';
$classes = ($i % 4 == 0) ? 'one-fourth first' : ' one-fourth';
?>
?>
<div id="post-<?php the_ID(); ?>" <?php post_class($classes) ?>>
<div id="post-<?php the_ID(); ?>" <?php post_class($classes) ?>>
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'showcase' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark">
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'showcase' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark">
<div class="overlay">
<div class="overlay">
<div class="overlay-inner">
<div class="overlay-inner">
<div class="overlay-details">
<div class="overlay-details">
<?php the_title( '<h4>', '</h4>' );?>
<?php the_title( '<h4>', '</h4>' );?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php if(has_post_thumbnail()) : the_post_thumbnail( 'showcase_entry_grid' ); endif; ?>
<?php if(has_post_thumbnail()) : the_post_thumbnail( 'showcase_entry_grid' ); endif; ?>
</a>
</a>
</div>
</div>
<?php
<?php
$i++;
$i++;
}
}
$output = ob_get_clean();
wp_reset_postdata();
if ( $output ) {
$output = ob_get_clean();
return '<div class="showcase-entry-grid">' . $output . '</div>';
}
wp_reset_query();
if ( $output ) {
return '<div class="showcase-entry-grid">' . $output . '</div>';
}
}
}