• Resolved ifiroth

    (@ifiroth)


    Hello,

    I’m trying to get the image link and item_count of each listing_category when writing a hook in Listing Hive functions.php.

    Do you have any idea on how I may proceed ?

    Here’s my attemps so far

    
    <?php
    function add_image_to_submenu($items, $args) {
    	
    	// echo '<pre>' . print_r(get_defined_vars(), true) . '</pre>';
    	
    	foreach($items as &$item) {
    		if ($item->menu_item_parent != 0) {
    			
    			$item->title = '<b>'. $item->ID .'</b> '. $item->title;
    			echo '<pre>'.var_dump($item).'</pre>';
    		}
    		
    		// Models\Listing
    	}
    	
    	return $items;
    }
    
    add_filter( 'wp_nav_menu_objects', 'add_image_to_submenu', 10, 2);
    ?>
    

    Thank you for any reply.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Get image and item count of listing_category’ is closed to new replies.