The code I supplied in my previous post is used to output a specific widget in a template file, in this case the Dropdown Cart Widget.
You can do this in two ways (that I am aware of):
1. Use the code I posted earlier, just put it wherever you want it to be.
2. Register a widget area in your functions.php and place a code snippet where you want to show it. Then go to Appearance -> Widgets and drag-and-drop the Dropdown Cart Widget to the widget area you just created.
You can read more about widgets under:
WordPress Widgets
Widgetizing Themes
The following code is taken from “Widgetizing themes” and slightly edited. Put this code into your functions.php file.
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Woocommerce Dropdown Cart',
'id' => 'wc_dropdown_cart',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
) );
}
add_action( 'widgets_init', 'arphabet_widgets_init' );
Then put the following code wherever you want the dropdown cart to shop up. Maybe in header.php?
<?php
if ( dynamic_sidebar('wc_dropdown_cart') ) :
else : ?>
<?php endif; ?>
Remember that you have to activate the widget under Appearance -> Widgets.