Register a widget area when a theme option has been saved?

In functions.php write this code function my_optionally_widgets() { $option = get_options(‘wantwidget’); if($option == ‘yes’) { register_widget(‘mywidget’); /* add other widgets for registration here */ } } add_action(‘widgets_init’, ‘my_optionally_widgets’); function my_optionally_sidebars() { $option = get_options(‘wantsidebar’); if($option == ‘yes’) { register_sidebar($args); /* add other sidebars for registration here */ } } add_action(‘init’, ‘my_optionally_sidebars’); Remember that Widget Areas … Read more

Hide cart when empty [closed]

Just add another AND (&&) clause to the end of it. <?php if ( is_woocommerce_activated() && isset( $woo_options[‘woocommerce_header_cart_link’] ) && ‘true’ == $woo_options[‘woocommerce_header_cart_link’] && sizeof( $woocommerce->cart->cart_contents ) !== 0) {…} Probably best to take a look at some of the PHP tutorials or documentation around as you will be coming up against this type of … Read more