Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] )) {
- $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );
- $menu_items = wp_get_nav_menu_items($menu->term_id);
- }
- foreach ( $menu_items as $menu_item ) {
- $numbers[] = get_post_meta( $menu_item->ID, '_menu_item_object_id', true );
- }
- for ($i=0; $i < count($numbers); $i++) {
- $id = $numbers[$i];
- $post = get_post($id);
- $title = get_the_title($id);
- $wp_customize->add_setting('tla'.$i, array(
- 'default' => '',
- 'sanitize_callback' => 'theme_sanitize'));
- $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'tla'.$id, array(
- 'label' => 'Site title: '.$title,
- 'section' => 'backgrounds',
- 'settings' => 'tla'.$i)));
- ?> <style type="text/css">.fp-section-<?php echo $i;?>:{background-image: url(<?php get_theme_mod('tla'.$i);?>)}</style> <?php
- echo get_theme_mod( 'tla'.$i );
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment