Skip to content

Instantly share code, notes, and snippets.

@billerickson
Forked from erkiziltoprak/single.php
Last active November 3, 2016 14:18
Show Gist options
  • Save billerickson/90f3807a72a818fe67f957558d6a8095 to your computer and use it in GitHub Desktop.
Save billerickson/90f3807a72a818fe67f957558d6a8095 to your computer and use it in GitHub Desktop.
<?php
// This file handles single entries, but only exists for the sake of child theme forward compatibility.
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
add_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 12 );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
add_action( 'genesis_entry_header', 'genesis_post_info', 3 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
add_action( 'genesis_entry_header', 'jan_featured_img', 1 );
function jan_featured_img() {
if ( has_post_thumbnail() ) { // checks post has thumbnail
// gets URL for that image
$background = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), 'featured-image' );
if (is_array($background)) {
// echo the output
echo '<div class="entry-header-wrap"><div class="entry-header-bg" style="background: url(' ;
echo $background[0];
echo ') ">';
echo '</div>';
}}
else { // if no featured image, adds class to use default image
echo '<div class="entry-header-wrap"><div class="entry-header-bg">';
genesis_widget_area( 'ontop', array(
'before' => '<div class="features-widgetarea">',
'after' => '</div>',
) );
echo '</div>';
}}
add_action( 'genesis_entry_header', 'jan_featured_img_close', 99 );
function jan_featured_img_close() {
echo '</div>';
}
add_filter( 'genesis_post_info', 'sp_post_info_filter' );
function sp_post_info_filter($post_info) {
$post_info = '[post_date] &nbsp; / &nbsp; [post_categories] ';
return $post_info;
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment