Theme customizer: How do you grab the value later?

I made one change… $wp_customize->add_setting( // ID ‘primm_slider_speed’, // Arguments array array( ‘default’ => ‘5000’, ‘type’ => ‘theme_mod’ <– made change right here. ) ); ‘type’ = ‘option’ just didn’t work. ‘type’ = ‘theme_mod’ totally nailed it. Option set manually to 6200, hit save. Refresh home page. Output now: Slider Timing: 6200string(4) “6200” Big Ouch… … Read more

Add pre-existing meta box to new custom post type

This depends on how your parent theme hooks in the meta_boxes. If the callbacks are hooked to add_meta_boxes and written similar to the following from the Codex: function myplugin_add_meta_box() { $screens = array( ‘post’, ‘page’ ); foreach ( $screens as $screen ) { add_meta_box( ‘myplugin_sectionid’, __( ‘My Post Section Title’, ‘myplugin_textdomain’ ), ‘myplugin_meta_box_callback’, $screen ); … Read more

Adding Custom Javascript to Skeleton Child Theme

One problem: if you define the script in a wp_register_script() like so: wp_register_script( ‘jquery.imagemapster.js’, get_template_directory_uri() . ‘/javascripts/jquery.imagemapster.js’, array(‘jquery’), ‘1.2.6’, false ); …then you only need to reference the defined script’s name in the wp_enqueue_script() call, like so: wp_enqueue_script( ‘jquery.imagemapster.js’ ); Re-declaring all of the parameters in wp_enqueue_script() shouldn’t cause the fatal error you describe; however, … Read more

Which settings/options are saved on a theme-basis and how does this affect theme-switching?

After doing some research this answer became a bit longer than expected, but this is the essence: TL;DR: Menu placement and Widget placement/order is saved on a Theme basis and can therefore be restored when switching Themes. This does not include the individual settings of Menus and Widgets, so if you change them these changes … Read more

Unregistering a Sidebar in Child Theme

It should be possible to use the after_setup_theme hook to unregister the sidebar you don’t want like this: function go_away_extra_sidebar(){ unregister_sidebar( ‘Footer’ ); } add_action( ‘after_setup_theme’, ‘go_away_extra_sidebar’ ); Happy Coding, Kuchenundkakao

Edit theme wp_head

You can remove some default WP links of the head by using remove_action(). For example: // Removes the wlwmanifest link remove_action( ‘wp_head’, ‘wlwmanifest_link’ ); // Removes the RSD link remove_action( ‘wp_head’, ‘rsd_link’ ); // Removes the WP shortlink remove_action( ‘wp_head’, ‘wp_shortlink_wp_head’, 10, 0 ); // Removes the canonical links remove_action( ‘wp_head’, ‘rel_canonical’ ); // Removes … Read more

Hard Code Pages into a Theme for a Network (multisite) Installation

Hook into wpmu_new_blog and create your pages: add_action(‘wpmu_new_blog’, ‘create_my_pages’, 10, 2); function create_my_pages($blog_id, $user_id){ switch_to_blog($blog_id); // not really need, new blogs shouldn’t have any content if(get_page_by_title(‘About this Network’)) return; // create each page $page_id = wp_insert_post(array( ‘post_title’ => ‘About this Network’, ‘post_name’ => ‘about-this-network’, ‘post_content’ => ‘Co za asy…’, ‘post_status’ => ‘publish’, ‘post_author’ => $user_id, … Read more