Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_Modules_Menu::merge_item_data( $item )
Merge Item data into the $item object.
Description Description
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Parameters Parameters
- $item
-
(Required)
Return Return
(mixed)
Source Source
File: includes/modules/menus.php
public static function merge_item_data( $item ) { if ( ! is_object( $item ) || ! isset( $item->ID ) || $item->ID <= 0 ) { return $item; } // Merge Rules. foreach ( PUM_Modules_Menu::get_item_options( $item->ID ) as $key => $value ) { $item->$key = $value; } if ( is_admin() ) { return $item; } if ( isset( $item->popup_id ) ) { $item->classes[] = 'popmake-' . $item->popup_id; } /** * Check menu item's classes for popmake-###. Do this after the above conditional to catch the class we add too. * Tested both using strpos followed by preg_match as well as just doing preg_match on all and this solution * was just a tiny bit faster. But, if a site has 100 menu items, that tiny difference will add up. */ foreach ( $item->classes as $class ) { if ( strpos( $class, 'popmake-' ) !== false ) { if ( 0 !== preg_match( '/popmake-(\d+)/', $class, $matches ) ) { PUM_Site_Popups::preload_popup_by_id_if_enabled( $matches[1] ); } } } return $item; }
Expand full source code Collapse full source code View on Trac