Remove featured image

Community Forums Forums Design Tips and Tricks Remove featured image

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  viorelepuran 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #102071

    viorelepuran
    Member
    Post count: 25

    Hello, i am using Metro Pro theme and i am trying to remove the featured image from full width post only.Does anyone knows hot to do it?
    I tryed to add this code, but i had no luck.Please share your wisdom with me

    function be_remove_image_from_features() {
    // First, we make sure we’re in the grid loop.
    if( ! apply_filters( ‘genesis_initial_layouts’, false ) )
    return;

    if( in_array( ‘full-width-content’, get_post_class() ) ) {
    remove_action( ‘genesis_entry_content’, ‘genesis_do_post_image’, 8 );
    remove_action( ‘genesis_post_content’, ‘genesis_do_post_image’ );
    } else {
    add_action( ‘genesis_entry_content’, ‘genesis_do_post_image’, 8 );
    add_action( ‘genesis_post_content’, ‘genesis_do_post_image’ );
    }
    }
    add_action( ‘genesis_before_entry’, ‘be_remove_image_from_features’ );
    add_action( ‘genesis_before_post’, ‘be_remove_image_from_features’ );

    #102083

    braddalton
    Participant
    Post count: 10243

    Link to the full width post please.


    #102084

    viorelepuran
    Member
    Post count: 25

    Brad, thank you for being so king and trying to help me, but i tought about it more and more, and comed up with this code, that worker like a charme:

    function be_remove_image_from_features() {
    $site_layout = genesis_site_layout();

    if( ‘full-width-content’ === $site_layout) {
    remove_action( ‘genesis_entry_content’, ‘genesis_do_post_image’, 8 );
    remove_action( ‘genesis_post_content’, ‘genesis_do_post_image’ );
    } else if ( genesis_site_layout(‘default’) ) {
    add_action( ‘genesis_entry_content’, ‘genesis_do_post_image’, 8 );
    add_action( ‘genesis_post_content’, ‘genesis_do_post_image’ );
    }
    }
    add_action( ‘genesis_before_entry’, ‘be_remove_image_from_features’ );
    add_action( ‘genesis_before_post’, ‘be_remove_image_from_features’ );

    Thank you for taking the time to respond to my problem!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.