Override function in single.php Genesis child theme

Wordpress

I am using the Monochrome Pro Genesis child theme. I want to remove the monochrome_setup_full_width function in single.php that display a background header (featured) image and gravatar in my 5 custom post types, but leave this code for regular post type.

I tried to remove the actions in my functions.php file, then tried making single-post-type.php. That had no effect and I don't want to make 5 separate single files anyway. Is there a filter that would work for this?

Here is the function in single.php.

**
* Runs function if post has featured image and full-width content layout.
*
* @since 1.0.0
*/
function monochrome_setup_full_width() {

$run = genesis_site_layout() === 'full-width-content' && has_post_thumbnail();

if ( ! $run ) {
    return;
}

add_action( 'genesis_after_header', 'monochrome_entry_background_post' );
/**
 * Outputs background image.
 *
 * @since 1.0.0
 */
function monochrome_entry_background_post() {

    $image = genesis_get_image( array( 'format' => 'url' ) );

    echo '<div class="entry-background" style="background-image: url(' . esc_url( $image ) . ')"></div>';

}

add_action( 'genesis_entry_header', 'monochrome_gravatar_post', 7 );
/**
 * Outputs Gravatar.
 *
 * @since 1.0.0
 */
function monochrome_gravatar_post() {

    echo '<div class="entry-avatar">';
    echo get_avatar( get_the_author_meta( 'user_email' ), 110 );
    echo '</div>';

  }

}
Share:

Post a Comment

Designed by OddThemes | Distributed by Blogger Themes