WordPress master + child themes + Git workflow

Why not use a completely separate repo for each child-theme site once its established? Clone the master repo when spinning up the environment, remove the Git directory, init a new Git repo, and push it up to wherever? Now each child theme can be developed independently of each other. Alternatively, if you’re using the same … Read more

How to transfer changes to a child theme?

There are three core principles to parent/child theme logic in WordPress: functions.php files from both parent and child get executed during load, with the child one first (this is a little counter-intuitive so worth remembering). “Template directory” refers to parent theme and “stylesheet directory” refers to child theme. If no child theme is being used … Read more

Child Theme: how to override variables?

I’m mobile, so this will be short. Use the after_setup_theme hook to add a function to set those variables. Declare them as global inside that function before setting them. Hope that helps. If anybody wants to add an example to this answer before I get home, feel free. 😉

jquery script not enqueued in child theme

There are two parts in the question I want to address: It didn’t work because the action uses a plural form: wp_enqueue_scripts, not wp_enqueue_script. I guess this happened, because the function you have to use here – wp_enqueue_script() – does use a singular. You should not use the function wp_enqueue_script() with so many parameters. Register … Read more

Jquery in Child Theme

First off, jquery is most likely already enqueued by the main theme. But if not, the proper way is to call wp_enqueue_script(‘jquery’) in a function for the action hook wp_enqueue_scripts. Example: function enqueue_jquery() { wp_enqueue_script(‘jquery’); } add_action(‘wp_enqueue_scripts’, ‘enqueue_jquery’). This code would need to be added to the functions.php file for your child theme. You would … Read more

Hiding a theme’s meta box

Remove WordPress Meta Boxes You have to make use of the function called remove meta box. Description: Removes a meta box or any other element from a particular post edit screen of a given post type. It can be also used to remove a widget from the dashboard screen. Steps to remove the meta box … Read more

Optimal approach for replacing the 8 header images in a child theme?

I am never sure about ‘optimal approach’ – however, I am using this in the functions.php in a child theme of Twenty Eleven //deregister the header images of Twenty Eleven, and register a few new RAW header images// add_action( ‘after_setup_theme’, ‘raw_theme_header_images’, 11 ); function raw_theme_header_images() { unregister_default_headers( array( ‘wheel’, ‘shore’, ‘trolley’, ‘pine-cone’, ‘chessboard’, ‘lanterns’, ‘willow’, … Read more

Assign Menus to Theme Locations with theme activation

Well, I wrote a solution so writing it here: /* This action copies old theme’s theme location saves to new theme if new theme doesnt have saves before. */ add_action( ‘after_switch_theme’, ‘ajx_theme_locations_rescue’ ); function ajx_theme_locations_rescue() { // bug report / support: http://www.unsalkorkmaz.com/ // We got old theme’s slug name $old_theme = get_option( ‘theme_switched’ ); // … Read more