Banjerr
Banjerr

Reputation: 121

Can a child theme over-ride the parent theme?

I have a child theme which also has custom post types. I have the correct code in place to support thumbnails on these custom post types. I also have theme support added for post-thumbnails.

add_theme_support('post-thumbnails', array('post', 'page', 'upcoming_events', 'directory_listings'));

However, this doesn't allow featured images to show in the custom post types. BUT when I add this to the parent theme (which has only post in the array for add_theme_support) the custom post types do show the featured image.

Is there a way to make the featured images show in the custom post type, without having to modify the parent theme (changes to that will, of course, be lost when updated)?

Upvotes: 2

Views: 46

Answers (1)

David
David

Reputation: 5937

Use the priority argument in add_action to have the function load a little later..

function child_support() {
    add_theme_support('post-thumbnails', array('post', 'page', 'upcoming_events', 'directory_listings'));
}
add_action( 'after_setup_theme', 'child_support', 100 );

this should run after the parent themes hook (normal priority is 10, but the developer could have a later priority, so check if that value is above 100 if not working)

Upvotes: 1

Related Questions