Last active
December 26, 2015 12:19
-
-
Save srikat/7150754 to your computer and use it in GitHub Desktop.
For displaying Portfolio entries on homepage in Minimum Pro when using Display Posts Shortcode plugin. http://sridharkatakam.com/show-portfolio-entries-minimum-pros-homepage-addition-posts/
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
//* Customize the output of individual Portfolio entries | |
add_filter( 'display_posts_shortcode_output', 'sk_title_above_image', 10, 9 ); | |
function sk_title_above_image( $output, $atts, $image, $title, $date, $excerpt, $inner_wrapper, $content, $class ) { | |
$title = '<h2 itemprop="headline" class="entry-title"><a rel="bookmark" href="' . apply_filters( 'the_permalink', get_permalink() ) . '">' . apply_filters( 'the_title', get_the_title() ) . '</a></h2>'; | |
if ( $atts['image_size'] ) | |
$image = '<div class="portfolio-image"><a rel="bookmark" href="' . get_permalink() . '">' . get_the_post_thumbnail( $post->ID, $image_size ) . '</a></div> '; | |
else $image = ''; | |
$output = '<' . $inner_wrapper . ' class="' . implode( ' ', $class ) . '">' . $title . $image . $date . $excerpt . $content . '</' . $inner_wrapper . '>'; | |
return $output; | |
} |
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
//* Show Portfolio entries above content on homepage | |
add_action( 'genesis_before_content_sidebar_wrap', 'sk_portfolio_entries', 16 ); |
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
function sk_portfolio_entries() { | |
echo '<div class="home-portfolio"><div class="wrap"><h1 itemprop="headline" class="entry-title">From the Portfolio</h1>' . do_shortcode('[display-posts post_type="portfolio" image_size="portfolio" posts_per_page="4" wrapper="div"]') . '<div class="full-portfolio-link"><a href="http://genesis.dev/portfolio/">View our full Portfolio »</a></div></div></div>'; | |
} |
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
/* Portfolio entries on homepage | |
--------------------------------------------- */ | |
.home-portfolio { | |
border-bottom: 5px solid #f5f5f5; | |
margin-bottom: 60px; | |
margin-bottom: 6rem; | |
padding: 0 0 20px 0; | |
padding: 0 0 2rem 0; | |
} | |
.home-portfolio h1.entry-title { | |
margin-bottom: 4rem; | |
} | |
.display-posts-listing { | |
overflow: hidden; | |
} | |
.display-posts-listing .listing-item { | |
float: left; | |
margin-bottom: 60px; | |
margin-bottom: 6rem; | |
width: 50%; | |
} | |
.display-posts-listing .listing-item:nth-of-type(2n) { | |
float: right; | |
padding-left: 30px; | |
padding-left: 3rem; | |
} | |
.display-posts-listing .listing-item:nth-of-type(2n+1) { | |
clear: left; | |
padding-right: 30px; | |
padding-right: 3rem; | |
} | |
.full-portfolio-link { | |
float: right; | |
margin-top: -3rem; | |
} | |
@media only screen and (max-width: 1023px) { | |
.display-posts-listing .listing-item { | |
text-align: center; | |
} | |
.home-portfolio h1.entry-title { | |
text-align: center; | |
} | |
} | |
@media only screen and (max-width: 768px) { | |
.display-posts-listing .listing-item { | |
width: 100%; | |
} | |
.display-posts-listing .listing-item:nth-of-type(2n), | |
.display-posts-listing .listing-item:nth-of-type(2n+1) { | |
float: none; | |
padding: 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment