Hi. How can we help?

How to add the Request a Quote List Widget to the menu, as last item

To add the Request a Quote List Widget to the menu, as last item
add this codes to your theme/child theme functions.php file (at the end of the file)

add_filter( 'wp_nav_menu_items', 'add_raq_widget_to_menu', 10, 2 );
function add_raq_widget_to_menu( $items, $args ) {
    if ( $args->theme_location == 'primary') {
        ob_start();
        $instance = array(
            'title'           => '',
            'item_name'=>'',
            'item_plural_name'=>'',
            'show_thumbnail'  => 1,
            'show_price'      => 1,
            'show_quantity'   => 1,
            'show_variations' => 1,
        );

        the_widget( 'YITH_YWRAQ_Mini_List_Quote_Widget', $instance );

        $widgt = ob_get_clean();

        $items .= '<li><div class="site-raq">' . $widgt . '</div></li>';
    }


    return $items;
}

keep attention to this line : $args->theme_location == 'primary' , you will probably need to change the primary text with the menu position name of your theme.

Also you will probably need some custom css code in order to style the widget in order to be like your menu style

Was this article helpful?
0 out of 0 found this helpful

Back to Help Center >