Set Featured Image not appearing in child theme


Some parent theme switched off certain features which would affect the child theme. For example, the parent theme might have this line:

add_theme_support( 'post-thumbnails' , array( 'post' ));

this means that there won’t be featured image support for post_type other than “post” in the child theme. If featured image support is needed, the child theme needs to overwrite this feature after the parent theme has been initialised. We need to use the “after_setup_theme” hook.

add_action( 'after_setup_theme', 'child_add_theme_support');
function child_add_theme_support(){
  add_theme_support( 'post-thumbnails', array( 'post', 'page', 'product' ) );
}      

The above code will then allow featured image in post, page and product for example.

Like it.? Share it:

Comments are closed.