Created
August 20, 2013 15:18
-
-
Save agusmu/6282835 to your computer and use it in GitHub Desktop.
PrimaShop - Create 3 Columns Grid Blog Page
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 | |
/** | |
* The template for displaying content using "featured image and excerpt" style. | |
* But we change it to be 3 columns grid. | |
* | |
* @category PrimaShop | |
* @package Templates | |
* @author PrimaThemes | |
* @link http://www.primathemes.com | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
$prima_column = 3; | |
// Increase loop count | |
global $prima_loop; | |
if ( empty( $prima_loop ) ) | |
$prima_loop = 0; | |
$prima_loop++; | |
// Extra post classes | |
$classes = array(); | |
$classes[] = 'post-blog'; | |
$classes[] = 'post-grid'; | |
if ( 0 == ( $prima_loop - 1 ) % $prima_column || 1 == $prima_column ) | |
$classes[] = 'first'; | |
if ( 0 == $prima_loop % $prima_column ) | |
$classes[] = 'last'; | |
?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class( $classes ); ?> > | |
<div class="entry"> | |
<h2 class="post-title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a></h2> | |
<?php echo do_shortcode( prima_get_setting( 'meta_'.get_post_type(), null, '<p class="post-meta"><small>%setting%</small></p>' ) ); ?> | |
<div class="post-content group"> | |
<?php prima_image( array ( 'width' => 700, 'height' => 275, 'image_class' => 'image-featured', 'link_to_post' => true ) ); ?> | |
<?php the_excerpt(); ?> | |
</div> | |
</div> | |
</article> |
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
/* 3 columns blog post grid */ | |
.post-grid { | |
margin-right: 3.8%; | |
margin-bottom: 25px; | |
width: 30.76666667%; | |
float: left; | |
} | |
.post-grid.first { | |
clear:both; | |
} | |
.post-grid.last { | |
margin-right:0; | |
} | |
.post-grid h2.post-title { | |
font-size:20px; | |
} | |
.navigation { | |
clear:both; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tutorial: http://www.primathemes.com/documentation/primashop-create-3-columns-grid-blog-page/