コード例 #1
0
function ct_founder_reset_customizer_options()
{
    if (empty($_POST['founder_reset_customizer']) || 'founder_reset_customizer_settings' !== $_POST['founder_reset_customizer']) {
        return;
    }
    if (!wp_verify_nonce($_POST['founder_reset_customizer_nonce'], 'founder_reset_customizer_nonce')) {
        return;
    }
    if (!current_user_can('edit_theme_options')) {
        return;
    }
    $mods_array = array('logo_upload', 'search_bar', 'full_post', 'excerpt_length', 'read_more_text', 'comments_display', 'custom_css');
    $social_sites = ct_founder_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_founder_mods_to_remove', $mods_array);
    foreach ($mods_array as $theme_mod) {
        remove_theme_mod($theme_mod);
    }
    $redirect = admin_url('themes.php?page=founder-options');
    $redirect = add_query_arg('founder_status', 'deleted', $redirect);
    // safely redirect
    wp_safe_redirect($redirect);
    exit;
}
コード例 #2
0
 {
     public function render_content()
     {
         echo $this->description;
     }
 }
 /***** Logo Upload *****/
 // section
 $wp_customize->add_section('ct_founder_logo_upload', array('title' => __('Logo', 'founder'), 'priority' => 30));
 // setting
 $wp_customize->add_setting('logo_upload', array('sanitize_callback' => 'esc_url_raw', 'transport' => 'postMessage'));
 // control
 $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo_image', array('label' => __('Upload custom logo.', 'founder'), 'section' => 'ct_founder_logo_upload', 'settings' => 'logo_upload')));
 /***** Social Media Icons *****/
 // get the social sites array
 $social_sites = ct_founder_social_array();
 // set a priority used to order the social sites
 $priority = 5;
 // section
 $wp_customize->add_section('ct_founder_social_media_icons', array('title' => __('Social Media Icons', 'founder'), 'priority' => 35, 'description' => __('Add the URL for each of your social profiles.', 'founder')));
 // 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_founder_sanitize_email', 'transport' => 'postMessage'));
         // control
         $wp_customize->add_control($social_site, array('label' => __('Email Address', 'founder'), 'section' => 'ct_founder_social_media_icons', 'priority' => $priority));
     } else {
         $label = ucfirst($social_site);
         if ($social_site == 'google-plus') {