FnClick
  • Portfolio
  • Services
    • Social Media Marketing
    • SEO
    • Web development
  • About us
    • Training
  • Blogs
  • Careers
GET IN TOUCH
  • Event Tracking

    • Google

      • Gtag.js
      • Analytics.js
    • Facebook

      • Facebook Event Tracking
    • General

      • Contact Form 7 Tracking
  • Scripts

    • Add font resizer
    • Current time in Devanagari/Nepali
    • Read More Function (Show / Hide)
  • Shopify

    • Additional information tab
  • WordPress

    • Download File after the form submit
    • GIFs as Favicon
    • First content image as Featured Image on listing page
    • Add Table of Content (TOC)
    • Content Image popup
    • Add estimated Read Time
    • Repeater field in Customizer
    • Display Publish Dates as ”Time Ago”
    • Breadcrumb
    • Show images on sub-menu navigation
    • Contact form 7 redirects
    • Universal .htaccess Directives
    • Number Pagination
    • Dynamic Breadcrumb List
  • WooCommerce

    • Update the Wishlist counts without reload
    • WooCommerce Product Schema
  • Server Rules

    • Apache

      • Expire header Rules
      • Redirect Rules
WordPress

Show images on sub-menu navigation

Display the images on the sub-menu items on the navigation of the site. Add code to the functions.php file:

function add_images_to_special_submenu( $items ) {
    $special_menu_parent_ids = array();
    foreach ( $items as $item ) {
        if ( in_array( 'icon-dropdown-menu', $item->classes, true ) && isset( $item->ID ) ) {
            $special_menu_parent_ids[] = $item->ID;
        }
        if ( in_array( $item->menu_ite