Support » Theme: FoodHunt » Show product description

  • alortiz3

    (@alortiz3)


    alortiz3

    Hello,

    I would like to show product description on my menu. How can I get that accomplished?

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hi @alortiz3,

    To get the result as you desired, you must activate the child theme. You can get knowledge about the child theme and download the FoodHunt child theme from the link below.

    https://themegrill.com/blog/tutorial-creating-wordpress-child-theme/

    Now that if you’ve downloaded and activated the child theme, then add the below code in a file name functions.php.

    function prefix_nav_description($item_output, $item, $depth, $args)
    {
    	if (!empty($item->description)) {
    		$item_output = $args->before;
    		$item_output .= '<a' . $attributes . '>';
    		$item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
    		$item_output .= '<br /><span class="sub">' . $item->description . '</span>';
    		$item_output .= '</a>';
    		$item_output .= $args->after;
    	}
    
    	return $item_output;
    }
    add_filter('walker_nav_menu_start_el', 'prefix_nav_description', 10, 4);

    After that, you can go to Menus from Appearance and click on the Screen Options button at the top right corner of the page. Then, check the Description box which will enable the descriptions field in your menu items.

    Thanks and Regards,
    Ankit

Viewing 1 replies (of 1 total)
  • The topic ‘Show product description’ is closed to new replies.