Exemplo n.º 1
0
function twentyfourteen_customize_register($wp_customize)
{
    // Add custom description to Colors and Background sections.
    $wp_customize->get_section('colors')->description = '';
    // Add postMessage support for site title and description.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->remove_section('background_image');
    $wp_customize->remove_section('static_front_page');
    $wp_customize->add_setting('text_color', array('default' => '#ffffff', 'type' => 'theme_mod', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'text_color', array('label' => __('Text Color', 'mytheme'), 'section' => 'colors', 'settings' => 'text_color', 'priority' => 10)));
    $wp_customize->add_setting('background_color', array('default' => '#2d2d2d', 'type' => 'theme_mod', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'background_color', array('label' => __('Background Color', 'mytheme'), 'section' => 'colors', 'settings' => 'background_color', 'priority' => 10)));
    $wp_customize->add_section('home_page', array('title' => 'Home Page', 'priority' => 35));
    $wp_customize->add_setting('default-image');
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'default-image', array('label' => 'Default Background Image', 'section' => 'home_page', 'settings' => 'default-image')));
    $wp_customize->add_section('my_social_settings', array('title' => 'Social Media Icons', 'priority' => 35));
    $social_sites = my_customizer_social_media_array();
    $priority = 5;
    foreach ($social_sites as $social_site) {
        $wp_customize->add_setting("{$social_site}", array('default' => ''));
        $wp_customize->add_control($social_site, array('label' => __("{$social_site} URL", 'social_icon'), 'section' => 'my_social_settings', 'type' => 'text', 'priority' => $priority));
        $priority = $priority + 5;
    }
    $wp_customize->add_setting("email_address", array('default' => ''));
    $wp_customize->add_control('email_address', array('label' => __("Contact E-mail Address", 'social_icon'), 'section' => 'my_social_settings', 'type' => 'text', 'priority' => $priority));
}
Exemplo n.º 2
0
function my_social_media_icons()
{
    $social_sites = my_customizer_social_media_array();
    /* any inputs that aren't empty are stored in $active_sites array */
    foreach ($social_sites as $social_site) {
        if (strlen(get_theme_mod($social_site)) > 0) {
            $active_sites[] = $social_site;
        }
    }
    /* for each active social site, add it as a list item */
    if (!empty($active_sites)) {
        echo "<ul class='social-media-icons'>";
        foreach ($active_sites as $active_site) {
            /* setup the class */
            $class = 'fa fa-' . $active_site;
            if ($active_site == 'email') {
                ?>
                    <li>
                        <a class="email" target="_blank" href="mailto:<?php 
                echo antispambot(is_email(get_theme_mod($active_site)));
                ?>
">
                            <i class="fa fa-envelope" title="<?php 
                _e('email icon', 'text-domain');
                ?>
"></i>
                        </a>
                    </li>
                <?php 
            } else {
                ?>
                    <li>
                        <a class="<?php 
                echo $active_site;
                ?>
" target="_blank" href="<?php 
                echo esc_url(get_theme_mod($active_site));
                ?>
">
                            <i class="<?php 
                echo esc_attr($class);
                ?>
" title="<?php 
                printf(__('%s icon', 'text-domain'), $active_site);
                ?>
"></i>
                        </a>
                    </li>
                <?php 
            }
        }
        echo "</ul>";
    }
}
Exemplo n.º 3
0
function my_social_media_icons()
{
    $social_sites = my_customizer_social_media_array();
    foreach ($social_sites as $social_site) {
        if (strlen(get_theme_mod($social_site)) > 0) {
            $active_sites[] = $social_site;
        }
    }
    if (!empty($active_sites)) {
        echo "<ul class='social-icons'>";
        foreach ($active_sites as $active_site) {
            $class = 'fa fa-' . $active_site;
            if ($active_site == 'email') {
                ?>
                <li>
                    <a class="email" target="_blank"
                       href="mailto:<?php 
                echo antispambot(is_email(get_theme_mod($active_site)));
                ?>
">
                        <span class="fa fa-envelope" title="<?php 
                _e('email icon', 'text-domain');
                ?>
"></span>
                    </a>
                </li>
            <?php 
            } else {
                ?>
                <li>
                    <a class="<?php 
                echo $active_site;
                ?>
" target="_blank"
                       href="<?php 
                echo esc_url(get_theme_mod($active_site));
                ?>
">
                        <span class="<?php 
                echo esc_attr($class);
                ?>
"
                              title="<?php 
                printf(__('%s icon', 'text-domain'), $active_site);
                ?>
"></span>
                    </a>
                </li>
                <?php 
            }
        }
        echo "</ul>";
    }
}