Last active
September 10, 2015 11:13
-
-
Save tlongren/d90becc304cbb812e53e to your computer and use it in GitHub Desktop.
Fixed StanleyWP portfolio grid
This file contains 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: Portfolio | |
* | |
* | |
* @file template-portfolio.php | |
* @package StanleyWP | |
* @author Brad Williams & Carlos Alvarez | |
* @copyright 2003 - 2014 Gents Themes | |
* @license license.txt | |
* @version Release: 3.0.3 | |
* @link http://codex.wordpress.org/Theme_Development#Pages_.28page.php.29 | |
* @since available since Release 1.0 | |
*/ | |
?> | |
<?php get_header(); ?> | |
<div class="container pt"> | |
<div class="row mt"> | |
<div class="col-lg-6 col-lg-offset-3 centered"> | |
<?php if( rwmb_meta( 'wtf_portfolio_title' ) !== '' ) { ?> | |
<?php echo rwmb_meta( 'wtf_portfolio_title' ); ?> | |
<hr> | |
<?php } ?> | |
<?php if (have_posts()) : ?> | |
<?php while (have_posts()) : the_post(); ?> | |
<?php the_content(); ?> | |
<?php endwhile; ?> | |
<?php endif; ?> | |
</div> | |
</div> | |
<?php | |
$loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => -1, 'orderby' => 'date')); | |
$count=0; | |
?> | |
<?php if ( $loop ) : | |
while ( $loop->have_posts() ) : $loop->the_post(); | |
if ($count == 0) { ?> | |
<div class="row mt centered"> | |
<?php } | |
$count++ | |
?> | |
<div class="col-lg-4"> | |
<?php if ( has_post_thumbnail()) : ?> | |
<a class="zoom green" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" > | |
<?php the_post_thumbnail(); ?> | |
</a> | |
<?php endif; ?> | |
<?php if(bi_get_data('project_title', '1')) {?> | |
<h4><?php the_title(); ?></h4> | |
<?php } ?> | |
</div> <!-- /col --> | |
<?php if ($count == 3) { ?> | |
<?php $count=0; ?> | |
</div> | |
<?php } ?> | |
<?php endwhile; else: ?> | |
</div> | |
<div class="error-not-found">Sorry, no portfolio entries for while.</div> | |
<?php endif; ?> | |
</div><!-- end of container --> | |
<?php get_footer(); ?> |
This file contains 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: Portfolio | |
* | |
* | |
* @file template-portfolio.php | |
* @package StanleyWP | |
* @author Brad Williams & Carlos Alvarez | |
* @copyright 2003 - 2014 Gents Themes | |
* @license license.txt | |
* @version Release: 3.0.3 | |
* @link http://codex.wordpress.org/Theme_Development#Pages_.28page.php.29 | |
* @since available since Release 1.0 | |
*/ | |
?> | |
<?php get_header(); ?> | |
<div class="container pt"> | |
<div class="row mt"> | |
<div class="col-lg-6 col-lg-offset-3 centered"> | |
<?php if( rwmb_meta( 'wtf_portfolio_title' ) !== '' ) { ?> | |
<?php echo rwmb_meta( 'wtf_portfolio_title' ); ?> | |
<hr> | |
<?php } ?> | |
<?php if (have_posts()) : ?> | |
<?php while (have_posts()) : the_post(); ?> | |
<?php the_content(); ?> | |
<?php endwhile; ?> | |
<?php endif; ?> | |
</div> | |
</div> | |
<?php | |
$loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => -1, 'orderby' => 'rand')); | |
$count=0; | |
?> | |
<?php if ( $loop ) : | |
while ( $loop->have_posts() ) : $loop->the_post(); | |
if ($count == 0) { ?> | |
<div class="row mt centered"> | |
<?php } | |
$count++ | |
?> | |
<div class="col-lg-4"> | |
<?php if ( has_post_thumbnail()) : ?> | |
<a class="zoom green" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" > | |
<?php the_post_thumbnail(); ?> | |
</a> | |
<?php endif; ?> | |
<?php if(bi_get_data('project_title', '1')) {?> | |
<h4><?php the_title(); ?></h4> | |
<?php } ?> | |
</div> <!-- /col --> | |
<?php if ($count == 3) { ?> | |
<?php $count=0; ?> | |
</div> | |
<?php } ?> | |
<?php endwhile; else: ?> | |
</div> | |
<div class="error-not-found">Sorry, no portfolio entries for while.</div> | |
<?php endif; ?> | |
</div><!-- end of container --> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should put this in your child theme root directory. File should be named
template-portfolio.php
.