Skip to content

Instantly share code, notes, and snippets.

@whyisjake
Created November 4, 2011 18:12
Show Gist options
  • Save whyisjake/1340052 to your computer and use it in GitHub Desktop.
Save whyisjake/1340052 to your computer and use it in GitHub Desktop.
WordPress Conditional for Gallery
<?php get_header(); ?>
<div class="row">
<?php
global $wp_query;
$postid = $wp_query->post->ID;
$big_video = get_post_custom_values('Big Video');
if (isset($big_video[0])) {
?>
<div class="big_video span16">
<?php make_youtube_embed('940', '528'); ?>
</div>
<?php }
$big_gallery = get_post_custom_values('Big Gallery');
if($big_gallery[0] == 1) {
echo do_shortcode('[gallery]');
}
?>
<div class="span10">
<?php if (!is_home()) { ?>
<ul class="breadcrumb">
<?php if(class_exists('bcn_breadcrumb_trail'))
{
$breadcrumb_trail = new bcn_breadcrumb_trail;
$breadcrumb_trail->opt['home_title'] = "Home";
$breadcrumb_trail->opt['current_item_prefix'] = '<li class="current">';
$breadcrumb_trail->opt['current_item_suffix'] = '</li>';
$breadcrumb_trail->opt['separator'] = '<span class="divider">&nbsp;/&nbsp;</span>';
$breadcrumb_trail->opt['home_prefix'] = '<li>';
$breadcrumb_trail->opt['home_suffix'] = '</li>';
$breadcrumb_trail->opt['max_title_length'] = 70;
$breadcrumb_trail->fill();
$breadcrumb_trail->display();
} ?>
</ul>
<?php } ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article <?php post_class(); ?>>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="entry-content">
<?php the_content(); ?>
<?php if (function_exists('vip_display_related_posts')) { vip_display_related_posts(); } ?>
</div>
<div class="postmeta row clear">
<div class="span1">
<?php echo get_avatar( get_the_author_meta('user_email'), 40); ?>
</div>
<div class="span8">
<p>Posted by <?php the_author_posts_link(); ?> | <a href="<?php the_permalink(); ?>"><?php the_time('l F jS, Y g:i A'); ?></a></p>
<p>Categories: <?php the_category(', '); ?> | <?php comments_popup_link(); ?> <?php edit_post_link('Fix me...', ' | '); ?></p>
</div>
</div>
</article>
<?php endwhile; ?>
<div class="breadcrumb">
<div class="pull-left"><?php previous_post_link('&larr;&nbsp;%link'); ?></div>
<div class="pull-right"><?php next_post_link('%link&nbsp;&rarr;'); ?> </div>
<div class="clear"></div>
</div>
<div class="comments">
<?php comments_template(); ?>
</div>
<?php else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi('', '', '', '', 8, false);} ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment