コード例 #1
0
ファイル: customizer.php プロジェクト: aragonc/Author
 // control
 $wp_customize->add_control('avatar_method', array('label' => __('Avatar image source', 'author'), 'section' => 'ct_author_avatar', 'settings' => 'avatar_method', 'type' => 'radio', 'description' => __('Gravatar uses the admin email address.', 'author'), 'choices' => array('gravatar' => __('Gravatar', 'author'), 'upload' => __('Upload an image', 'author'), 'none' => __('Do not display avatar', 'author'))));
 // setting
 $wp_customize->add_setting('avatar', array('sanitize_callback' => 'esc_url_raw'));
 // control
 $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'avatar', array('label' => __('Upload your avatar', 'author'), 'section' => 'ct_author_avatar', 'settings' => 'avatar')));
 /***** Logo Upload *****/
 // section
 $wp_customize->add_section('ct_author_logo_upload', array('title' => __('Logo', 'author'), 'priority' => 25, 'description' => __('Use this instead of the avatar if you want a non-rounded logo image.', 'author')));
 // setting
 $wp_customize->add_setting('logo_upload', array('sanitize_callback' => 'esc_url_raw'));
 // control
 $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo_image', array('label' => __('Upload custom logo.', 'author'), 'section' => 'ct_author_logo_upload', 'settings' => 'logo_upload')));
 /***** Social Media Icons *****/
 // get the social sites array
 $social_sites = ct_author_social_array();
 // set a priority used to order the social sites
 $priority = 5;
 // section
 $wp_customize->add_section('ct_author_social_media_icons', array('title' => __('Social Media Icons', 'author'), 'priority' => 35, 'description' => __('Add the URL for each of your social profiles.', 'author')));
 // create a setting and control for each social site
 foreach ($social_sites as $social_site => $value) {
     // if email icon
     if ($social_site == 'email') {
         // setting
         $wp_customize->add_setting($social_site, array('sanitize_callback' => 'ct_author_sanitize_email'));
         // control
         $wp_customize->add_control($social_site, array('label' => __('Email Address:', 'author'), 'section' => 'ct_author_social_media_icons', 'priority' => $priority));
     } else {
         $label = ucfirst($social_site);
         if ($social_site == 'google-plus') {
コード例 #2
0
ファイル: functions.php プロジェクト: aragonc/Author
function ct_author_reset_customizer_options()
{
    if (empty($_POST['author_reset_customizer']) || 'author_reset_customizer_settings' !== $_POST['author_reset_customizer']) {
        return;
    }
    if (!wp_verify_nonce($_POST['author_reset_customizer_nonce'], 'author_reset_customizer_nonce')) {
        return;
    }
    if (!current_user_can('edit_theme_options')) {
        return;
    }
    $mods_array = array('avatar_method', 'avatar', 'logo_upload', 'full_post', 'excerpt_length', 'read_more_text', 'comments_display', 'custom_css');
    $social_sites = ct_author_social_array();
    // add social site settings to mods array
    foreach ($social_sites as $social_site => $value) {
        $mods_array[] = $social_site;
    }
    $mods_array = apply_filters('ct_author_mods_to_remove', $mods_array);
    foreach ($mods_array as $theme_mod) {
        remove_theme_mod($theme_mod);
    }
    $redirect = admin_url('themes.php?page=author-options');
    $redirect = add_query_arg('author_status', 'deleted', $redirect);
    // safely redirect
    wp_safe_redirect($redirect);
    exit;
}
コード例 #3
0
ファイル: functions.php プロジェクト: kimyj9501/SingMyStory
    function ct_author_social_icons_output($source)
    {
        // get social sites array
        $social_sites = ct_author_social_array();
        // store the site name and url
        foreach ($social_sites as $social_site => $profile) {
            if ($source == 'header') {
                if (strlen(get_theme_mod($social_site)) > 0) {
                    $active_sites[$social_site] = $social_site;
                }
            } elseif ($source == 'author') {
                if (strlen(get_the_author_meta($profile)) > 0) {
                    $active_sites[$profile] = $social_site;
                }
            }
        }
        // for each active social site, add it as a list item
        if (!empty($active_sites)) {
            echo "<div class='social-media-icons'><ul>";
            foreach ($active_sites as $key => $active_site) {
                if ($active_site == 'email') {
                    ?>
                    <li>
                        <a class="email" target="_blank" href="mailto:<?php 
                    echo antispambot(is_email(ct_author_get_social_url($source, $key)));
                    ?>
">
                            <i class="fa fa-envelope" title="<?php 
                    _e('email icon', 'author');
                    ?>
"></i>
                        </a>
                    </li>
                <?php 
                } elseif ($active_site == "flickr" || $active_site == "dribbble" || $active_site == "instagram" || $active_site == "soundcloud" || $active_site == "spotify" || $active_site == "vine" || $active_site == "yahoo" || $active_site == "codepen" || $active_site == "delicious" || $active_site == "stumbleupon" || $active_site == "deviantart" || $active_site == "digg" || $active_site == "hacker-news" || $active_site == "vk" || $active_site == 'weibo' || $active_site == 'tencent-weibo') {
                    ?>
                    <li>
                        <a class="<?php 
                    echo $active_site;
                    ?>
" target="_blank" href="<?php 
                    echo esc_url(ct_author_get_social_url($source, $key));
                    ?>
">
                            <i class="fa fa-<?php 
                    echo esc_attr($active_site);
                    ?>
" title="<?php 
                    printf(__('%s icon', 'author'), $active_site);
                    ?>
"></i>
                        </a>
                    </li>
                <?php 
                } else {
                    ?>
                    <li>
                        <a class="<?php 
                    echo $active_site;
                    ?>
" target="_blank" href="<?php 
                    echo esc_url(ct_author_get_social_url($source, $key));
                    ?>
">
                            <i class="fa fa-<?php 
                    echo esc_attr($active_site);
                    ?>
-square" title="<?php 
                    printf(__('%s icon', 'author'), $active_site);
                    ?>
"></i>
                        </a>
                    </li>
                <?php 
                }
            }
            echo "</div></ul>";
        }
    }
コード例 #4
0
    function ct_author_social_icons_output()
    {
        // get social sites array
        $social_sites = ct_author_social_array();
        // icons that should use a special square icon
        $square_icons = array('linkedin', 'twitter', 'vimeo', 'youtube', 'pinterest', 'rss', 'reddit', 'tumblr', 'steam', 'xing', 'github', 'google-plus', 'behance', 'facebook');
        // store the site name and url
        foreach ($social_sites as $social_site => $profile) {
            if (strlen(get_theme_mod($social_site)) > 0) {
                $active_sites[$social_site] = $social_site;
            }
        }
        // for each active social site, add it as a list item
        if (!empty($active_sites)) {
            echo "<div class='social-media-icons'><ul>";
            foreach ($active_sites as $key => $active_site) {
                // get the square or plain class
                if (in_array($active_site, $square_icons)) {
                    $class = 'fa fa-' . $active_site . '-square';
                } else {
                    $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 
                    esc_attr(_e('email', 'author'));
                    ?>
"></i>
                        </a>
                    </li>
                <?php 
                } else {
                    ?>
                    <li>
                        <a class="<?php 
                    echo esc_attr($active_site);
                    ?>
" target="_blank" href="<?php 
                    echo esc_url(get_theme_mod($active_site));
                    ?>
">
                            <i class="<?php 
                    echo esc_attr($class);
                    ?>
" title="<?php 
                    echo esc_attr($active_site);
                    ?>
"></i>
                        </a>
                    </li>
                <?php 
                }
            }
            echo "</ul></div>";
        }
    }