Skip to content

Instantly share code, notes, and snippets.

@benweiser
Created June 9, 2015 05:33
Show Gist options
  • Select an option

  • Save benweiser/5086338778753f53ea71 to your computer and use it in GitHub Desktop.

Select an option

Save benweiser/5086338778753f53ea71 to your computer and use it in GitHub Desktop.
Single Portfolio Page With Bootstrap Classes
<?php
//**** Functions used on this page **//
// Show portfolio image on single portfolio page
function bw_show_featured_image() {
echo '<div class="project-image">';
$image_args = array(
'size' => 'large',
'attr' => array(
'class' => 'col-sm-4',
),
);
genesis_image( $image_args );
echo '</div>';
}
// Add bootstrap class to entry content
function portfolio_content_extraclass( $attributes ) {
$attributes['class'] = $attributes['class']. ' col-sm-8 ';
return $attributes;
}
function bw_portfolio_image(){
$image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
?>
<a href="<?php echo $image[0]; ?>" class="cboxElement" rel="lightbox[247]">
<div class="col-sm-4 project-image">
<?php
$image_args = array(
'size' => 'large',
'attr' => array(
'class' => 'thumbnail',
),
);
genesis_image( $image_args );
?>
</div>
</a>
<?php
}
function bw_summary_headline () {
echo '<h2>Project Summary</h2>';
}
//** Actions hooks and filters **//
// Force full width content
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
// Remove default bradcrumbs
remove_action('genesis_entry_header', 'genesis_do_breadcrumbs' , 3);
//*Remove the entry meta in the entry header
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
//* To remove empty markup, '<p class="entry-meta"></p>' for entries that have not been assigned to any Genre
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
// Add filter to hook entry content function
add_filter( 'genesis_attr_entry-content', 'portfolio_content_extraclass' );
// Display custom fields in Project Overview section
add_action( 'genesis_entry_content', 'bw_project_overview', 5 );
// Display static headline for Project Summary
add_action( 'genesis_entry_content', 'bw_summary_headline', 6 );
// Hook portfolio image with bootstrap class before entry content
add_action('genesis_before_entry_content', 'bw_portfolio_image');
// Previous and Next Post navigation to move between portfolio projects
add_action('genesis_entry_footer', 'bw_custom_post_nav');
// Do Genesis
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment