/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); ?> <?php echo $before_widget; ?> <?php if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="wpex-widget-social"> <?php $wpex_social_links = wpex_social_links(); //social loop foreach ($wpex_social_links as $wpex_social_link) { if (get_theme_mod('wpex_social_' . $wpex_social_link)) { echo '<li><a href="' . get_theme_mod('wpex_social_' . $wpex_social_link) . '" title="' . $wpex_social_link . '" target="_blank"><img src="' . get_template_directory_uri() . '/images/social/' . $wpex_social_link . '.png" alt="' . $wpex_social_link . '" /></a></li>'; } } ?> </ul> <?php echo $after_widget; ?> <?php }
function wpex_display_social() { if ('1' != get_theme_mod('wpex_header_aside', '1')) { return; } $wpex_social_links = wpex_social_links(); foreach ($wpex_social_links as $wpex_social_link) { if (get_theme_mod('wpex_social_' . $wpex_social_link)) { echo '<li><a href="' . get_theme_mod('wpex_social_' . $wpex_social_link) . '" title="' . $wpex_social_link . '" target="_blank"><img src="' . get_template_directory_uri() . '/images/social/' . $wpex_social_link . '.png" alt="' . $wpex_social_link . '" /></a></li>'; } } }
function wpex_display_social() { $wpex_social_links = wpex_social_links(); if (!$wpex_social_links) { return; } $output = '<ul id="header-social" class="clr">'; //get social links from array $social_links = wpex_social_links(); //social loop foreach ($social_links as $social_link) { if (of_get_option($social_link)) { $output .= '<li><a href="' . esc_url(of_get_option($social_link)) . '" title="' . $social_link . '" target="_blank" class="wpex-tooltip"><img src="' . get_template_directory_uri() . '/images/social/' . $social_link . '.png" alt="' . $social_link . '" /></a></li>'; } //option empty } //end foreach $output .= '</ul><!-- #social -->'; echo $output; }
echo esc_attr($this->value()); ?> </textarea> </label> <?php } } // Theme Settings Section $wp_customize->add_section('wpex_general', array('title' => __('Theme Settings', 'wpex'), 'priority' => 200)); // Logo Image $wp_customize->add_setting('wpex_logo', array('type' => 'theme_mod')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'wpex_logo', array('label' => __('Image Logo', 'wpex'), 'section' => 'wpex_general', 'settings' => 'wpex_logo', 'priority' => '1'))); // Enable/Disable Social $wp_customize->add_setting('wpex_header_aside', array('type' => 'theme_mod', 'default' => '1')); $wp_customize->add_control('wpex_header_aside', array('label' => __('Social Links', 'wpex'), 'section' => 'wpex_general', 'settings' => 'wpex_header_aside', 'type' => 'checkbox', 'priority' => '4')); // Copyright $wp_customize->add_setting('wpex_copyright', array('type' => 'theme_mod', 'default' => 'Powered by <a href=\\"http://www.wordpress.org\\" title="WordPress" target="_blank">WordPress</a> and <a href=\\"http://themeforest.net/user/WPExplorer?ref=WPExplorer" target="_blank" title="WPExplorer" rel="nofollow">WPExplorer Themes</a>')); $wp_customize->add_control(new WPEX_Customize_Textarea_Control($wp_customize, 'wpex_copyright', array('label' => __('Custom Copyright', 'wpex'), 'section' => 'wpex_general', 'settings' => 'wpex_copyright', 'type' => 'textarea', 'priority' => '8'))); // Theme Settings Section $wp_customize->add_section('wpex_social', array('title' => __('Social Options', 'wpex'), 'priority' => 201)); // Social Options $social_options = wpex_social_links(); $count = 0; foreach ($social_options as $social_option) { $count++; $name = $social_option = str_replace('_', ' ', $social_option); $name = ucfirst($name); $wp_customize->add_setting('wpex_social_' . $social_option, array('type' => 'theme_mod', 'default' => '')); $wp_customize->add_control('wpex_social_' . $social_option, array('label' => __($name, 'wpex'), 'section' => 'wpex_social', 'settings' => 'wpex_social_' . $social_option, 'type' => 'text', 'priority' => $count)); } }