Do I need to update the child theme too after updating the parent?

As you mentioned, a child theme is designed exactly for the purpose of not losing your changes upon updating the parent theme. Updating the child theme is not always mandatory, however there might be cases that you should do so. Consider this: You update the parent, and the update removes some of core functions, which … Read more

add_image_size is scaling, even though crop is set to true

from your question i under that you want fixed size cropped images when you upload image, why don’t you use wp_get_image_editor. I used it in my project where i wanted cropped images of fixed size so i did this code. $path = $newPath[‘basedir’].’/newImgas/’; $cropfile = uniqid() . ‘.png’; $cropfilename = $path.$cropfile; $cropImage = home_url(). ‘/wp-content/uploads/newImgas/’.$cropfile; … Read more

How to solve “Warning: Use of undefined constant” when overriding a parent theme function in the child theme?

Child themes are loaded before the parent theme. That’s why you’re able to replace functions that are wrapped in function_exists(). When themes use function_exists() they are taking advantage of the fact that child themes are loaded first to let the child theme define a function with the same name without throwing an error. The reason … Read more

add generated stylesheet from parent theme after child-themes style.css

Absolutely! Into functions.php, like you said. I’ll call it cache_busting_styles because I like how it sounds. First, you set up the style via wp_enqueue_style, then call it during the action hook wp_print_styles, Also, you’ll want to set up a variable and pass it in there as the version number as well: function cache_busting_styles() { //however … Read more

Removing custom meta box added in parent theme

Note: This is the merged version between my and @toscho answers. Explanation (by @toscho) Use add_meta_boxes_page as action hook. You can find the hook in wp-admin/edit-form-advanced.php and it displays as: do_action(‘add_meta_boxes_’ . $post_type, $post); Solution(s) Try the following action, which is inside register_post_type() as well. function wpse59607_remove_meta_box( $callback ) { remove_meta_box( ‘id-of-meta-box’ , ‘page’ , … Read more

is there a simple way to list every templates / php files used to generate a specific page?

WordPress does not really track what theme files are loaded beyond some basic things (for example $template global holds main template file). You can use PHP’s native get_included_files() to list all PHP source files loaded during request and narrow it down to your theme. Note that for more complex themes this will have not only … Read more

Child Theme Performance

When you set a child theme, basically WP looks into 2 directories to see if there are some overriding to make. So it adds some impact on performance. The use of @import in child CSS can also have some bad impact on performance grade. Most of the time, it depends on the parent’s theme quality. … Read more