Never actually adding the action? Or do I have to call the action?

You are using after_theme_switch action but the correct name is after_switch_theme. Also, you won’t see the echo statements on after_theme_switch and switch_theme. To debug things in that hooks you can use, for example, error_log() function and look for messages in PHP error log file (you need to have errors “On” and/or WP_DEBUG enabled). I’ve tested … Read more

Using the media library for theme customization

I figured this out. For anyone facing the same issue, I ended up using this code instead: function hi_customization_options( $wp_customize ) { $wp_customize->add_section( ‘landing_page_image’, array( ‘title’ => ‘Landing Page Image’, ‘priority’ => 35, ) ); $wp_customize->add_setting( ‘lp-image_selector’, array( ‘default’ => ”, ) ); $wp_customize->add_setting( ‘img-upload’ ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, ‘lp-image_selector’, array( ‘label’ => ‘Landing … Read more

Why is my container argument not working for wp_nav_menu() [closed]

As I am using the roots theme framework, this line removes the container argument: function roots_nav_menu_args($args=””) { $roots_nav_menu_args = array(); $roots_nav_menu_args[‘container’] = false; if (!$args[‘items_wrap’]) { $roots_nav_menu_args[‘items_wrap’] = ‘<ul class=”%2$s”>%3$s</ul>’; } if (!$args[‘depth’]) { $roots_nav_menu_args[‘depth’] = 2; } return array_merge($args, $roots_nav_menu_args); } add_filter(‘wp_nav_menu_args’, ‘roots_nav_menu_args’);