Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***** Images in main TOC ****/
- add_filter( 'wp_nav_menu_objects','add_menu_images', 10, 2 );
- function add_menu_images( $items, $args ) {
- if ($args->menu == "Main_TOC") {
- $img_array = array();
- foreach ( $items as $item ) {
- if (!$item->menu_item_parent) {
- $img_url = get_the_post_thumbnail_url($item->object_id);
- }
- }
- $args->items_wrap = '<ul id=%1$s class=%2$s style="background-image: url(' . $img_url . ')">%3$s</ul>';
- } // end if main TOC
- return $items;
- }
Add Comment
Please, Sign In to add comment