Last active
December 20, 2015 14:18
-
-
Save srikat/6d27c7027057b4ac083b to your computer and use it in GitHub Desktop.
Featured image section for Pages in Genesis. https://sridharkatakam.com/featured-image-section-for-pages-in-genesis/
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
// Enables the Excerpt meta box in Page edit screen. | |
function wpcodex_add_excerpt_support_for_pages() { | |
add_post_type_support( 'page', 'excerpt' ); | |
} | |
add_action( 'init', 'wpcodex_add_excerpt_support_for_pages' ); | |
// Register a custom image size for featured images on Pages | |
add_image_size( 'page-featured', 560, 175, true ); |
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 | |
add_action( 'genesis_after_header', 'sk_featured_section_pages' ); | |
function sk_featured_section_pages() { ?> | |
<div class="featured-section"> | |
<div class="wrap"> | |
<div class="one-half first"> | |
<?php genesis_do_breadcrumbs(); | |
genesis_do_post_title(); | |
the_excerpt(); ?> | |
</div> | |
<div class="one-half"> | |
<?php genesis_image( 'size=page-featured' ); ?> | |
</div> | |
</div> | |
</div> | |
<?php } | |
// Remove breadcrumbs | |
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); | |
// Remove entry header | |
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); | |
remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); | |
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); | |
// Modify breadcrumb arguments | |
add_filter( 'genesis_breadcrumb_args', 'sp_breadcrumb_args' ); | |
function sp_breadcrumb_args( $args ) { | |
$args['sep'] = ' > '; | |
$args['labels']['prefix'] = ''; | |
return $args; | |
} | |
genesis(); |
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
.featured-section { | |
padding: 30px 0; | |
background-color: #ededed; | |
border-bottom: 1px solid #d2d2d2; | |
} | |
.featured-section .breadcrumb { | |
margin-bottom: 10px; | |
} | |
.featured-section .entry-title { | |
margin-bottom: 20px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment