Iwani Khalid
Iwani Khalid

Reputation: 303

Theme Customization via Child Theme

I've just recently dived into Themes editing via Child Themes (I know. So last summer right but butter late than never). Since I'm a "programmer" by trial & error, I'm not sure what I'm doing most of the time.

Can anyone gimme any clue how to edit this kinda setup via Child Themes

1st layer: get_template_part( 'template-parts/content' );

2nd layer: do_action( 'hestia_blog_post_template_part', 'default' );

3rd layer: class-hestia-blog-post-layout.php [where the real thing really resides]

Thanks guys

Upvotes: 1

Views: 256

Answers (1)

Snuwerd
Snuwerd

Reputation: 459

You can override a template by taking the template file from the main theme, and then putting it in the same location in the child theme. So lets say the template is called class-hestia-blog-post-layout.php from mainthemefolder/templates/class-hestia-blog-post-layout.php then copy it to childthemefolder/templates/class-hestia-blog-post-layout.php.

Update

It looks like your theme (Hestia) isn't using the default way to use templates. Its definitely not you doing something wrong about how a child theme is supposed to work. I added template-parts/content.php to the child, and changed

hestia_blog_post_template_part

to

hestia_blog_post_template_part2

, and in the class-hestia-blog-post-layout.php in the child-theme I changed this line

add_action( 'hestia_blog_post_template_part', array( $this, 'render' ), 2 );

to this

add_action( 'hestia_blog_post_template_part2', array( $this, 'render' ), 2 );

But then it still didn't work. Then I noticed that the Class in class-hestia-blog-post-layout.php is loaded in hestia/inc/core/class-hestia-autoloader, in which i changed

'Hestia_Blog_Post_Layout' => HESTIA_PHP_INCLUDE . 'views/blog',

to

'Hestia_Blog_Post_Layout2' => HESTIA_PHP_INCLUDE . '../../hestia-child/inc/views/blog',

But it is still not working ...

For now I give up, sorry.

Upvotes: 2

Related Questions