Multisite automaticaly add widget shopping cart to sidebar
Hello, when user creates new site I want to put widget “Shopping cart” to sidebar. The main problem is: when at first time I go to newly created web site it shows only widget title but content is not showing, after refreshing site widget content shows up and all is working fine. What is the problem ? Could you help me? Maybe some woocommerce data is not loaded at creating new site. Woocommerce is network activated.
I am using hook: wpmu_new_blog
Widget to sidebar i am adding with this code:
$sidebars_widgets = array(); $sidebars_widgets['sidebar-1'] = array(); $sidebars_widgets['sidebar-1'] = 'shopping_cart-1'; update_option('sidebars_widgets', $sidebars_widgets); $shop_cart_array = array('title'=>"Shopping Cart"); $info = array( 1 => $shop_cart_array, "_multiwidget" => 1 ); update_option('widget_shopping_cart', $info);
The widget number “1” is just for this example.
- The topic ‘Multisite automaticaly add widget shopping cart to sidebar’ is closed to new replies.