コード例 #1
0
ファイル: functions.php プロジェクト: javalidigital/multipla
function wedding_style_setup()
{
    add_theme_support('custom-header', array('default-image' => '', 'header-text' => false, 'wp-head-callback' => 'wedding_style_header_style'));
    $wedding_style_defaults = array('default-color' => 'ffffff', 'default-image' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '');
    register_nav_menu('primary-menu', __('Primary Menu', 'WeddingStyle'));
    add_theme_support('custom-background', $wedding_style_defaults);
    //
    if (!get_theme_mod('background_color', false)) {
        set_theme_mod('background_color', 'ffffff');
    }
    //Enable post and comments RSS feed links to head
    add_theme_support('automatic-feed-links');
    // Enable post thumbnails
    add_theme_support('post-thumbnails', array('post'));
    set_post_thumbnail_size(140, 130, true);
    add_image_size('exclusive-width', 240, 182, true);
    load_theme_textdomain('WeddingStyle', get_template_directory() . '/languages');
    add_editor_style();
    global $wedding_style_layout_page;
    foreach ($wedding_style_layout_page->options_themeoptions as $value) {
        if (isset($value['id'])) {
            ${$value}['var_name'] = $value['std'];
        }
    }
}
コード例 #2
0
ファイル: import-demo.php プロジェクト: brandmobility/kikbak
function wf_theme_import_demo_menus()
{
    global $wpdb;
    $table_name = $wpdb->prefix . 'terms';
    $menu_id = $wpdb->get_var("SELECT term_id FROM {$table_name} where name = 'Petrichor Primary Menu'");
    set_theme_mod('nav_menu_locations', array('primary' => $menu_id));
}
コード例 #3
0
function xt_install_menu($global)
{
    $menu_id = wp_create_nav_menu('新淘客菜单');
    if ($menu_id) {
        //home
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => get_home_url('/'), 'menu-item-title' => '首页', 'menu-item-status' => 'publish', 'menu-item-position' => 1));
        //shares
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_shares_search_url(), 'menu-item-title' => '逛街啦', 'menu-item-status' => 'publish', 'menu-item-position' => 2));
        //albums
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_albums_search_url(), 'menu-item-title' => '专辑', 'menu-item-status' => 'publish', 'menu-item-position' => 3));
        //taobaos
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_taobao_search_url(), 'menu-item-title' => '淘宝', 'menu-item-status' => 'publish', 'menu-item-position' => 6));
        //paipais
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_paipai_search_url(), 'menu-item-title' => '拍拍', 'menu-item-status' => 'publish', 'menu-item-position' => 7));
        //bijias
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_bijia_search_url(), 'menu-item-title' => '比价', 'menu-item-status' => 'publish', 'menu-item-position' => 8));
        //tuans
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_tuan_search_url(), 'menu-item-title' => '团购', 'menu-item-status' => 'publish', 'menu-item-position' => 9));
        //coupons
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_coupon_search_url(), 'menu-item-title' => '折扣', 'menu-item-status' => 'publish', 'menu-item-position' => 10));
        //temais
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_temai_search_url(), 'menu-item-title' => '特卖', 'menu-item-status' => 'publish', 'menu-item-position' => 11));
        //stars
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_site_url('stars'), 'menu-item-title' => '明星', 'menu-item-status' => 'publish', 'menu-item-position' => 12));
        //brands
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_site_url('brands'), 'menu-item-title' => '品牌', 'menu-item-status' => 'publish', 'menu-item-position' => 13));
        set_theme_mod('nav_menu_locations', array('primary' => $menu_id));
        $global['isMenu'] = 1;
        update_option(XT_OPTION_GLOBAL, $global);
    }
}
コード例 #4
0
ファイル: init.php プロジェクト: mertyildiran/grandinsaat
 /**
  * Add menus
  *
  * @since 0.0.1
  */
 public function set_demo_menus()
 {
     // Menus to Import and assign - you can remove or add as many as you want
     $primary_menu = get_term_by('name', 'Primary', 'nav_menu');
     $footer_menu = get_term_by('name', 'Footer', 'nav_menu');
     set_theme_mod('nav_menu_locations', array('primary' => $primary_menu->term_id, 'footer' => $footer_menu->term_id));
 }
コード例 #5
0
ファイル: helpers.php プロジェクト: IlhamFS/wordpress
/**
 * Takes care of all the migration and compatibility issues with previous versions.
 */
function kirki_update()
{
    $version = get_option('kirki_version');
    $version = !$version ? '0' : $version;
    // < 0.6.1 -> 0.6.2
    if (!$version) {
        /**
         * In versions 0.6.0 & 0.6.1 there was a bug and some fields were saved as ID_opacity istead if ID
         * This will fix the wrong settings naming and save new settings.
         */
        $field_ids = array();
        $fields = Kirki::fields()->get_all();
        foreach ($fields as $field) {
            $field = Kirki::field()->sanitize($field);
            if ('background' != $field['type']) {
                $field_ids[] = $field['settings'];
            }
        }
        foreach ($field_ids as $field_id) {
            if (get_theme_mod($field_id . '_opacity') && !get_theme_mod($field_id)) {
                set_theme_mod($field_id, get_theme_mod($field_id . '_opacity'));
            }
        }
    }
    if (!$version || version_compare(Kirki::$version, $version)) {
        update_option('kirki_version', Kirki::$version);
    }
}
コード例 #6
0
 public function web_dorado_theme_update_and_get_options_typography()
 {
     if (isset($_GET['page']) && $_GET['page'] == "web_dorado_theme" && isset($_GET['controller']) && $_GET['controller'] == "typography_page") {
         if (isset($_REQUEST['action']) == 'save') {
             foreach ($this->options_typography as $value) {
                 if (isset($_REQUEST[$value['var_name']])) {
                     $sanitize_type = 'weddings_do_nothing';
                     if (isset($value['sanitize_type']) && $value['sanitize_type']) {
                         $sanitize_type = $value['sanitize_type'];
                     }
                     set_theme_mod($value['id'], $sanitize_type($_REQUEST[$value['var_name']]));
                 } else {
                     remove_theme_mod($value['id']);
                 }
             }
             header("Location: themes.php?page=web_dorado_theme&controller=typography_page&saved=true");
             die;
         } else {
             if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset') {
                 foreach ($this->options_typography as $value) {
                     remove_theme_mod($value['id']);
                 }
                 header("Location: themes.php?page=web_dorado_theme&controller=typography_page&reset=true");
                 die;
             }
         }
     }
 }
コード例 #7
0
ファイル: functions.php プロジェクト: Matwilk/wordpress
function floki_default_options()
{
    $defaults = floki_get_option_defaults();
    foreach ($defaults as $k => $v) {
        set_theme_mod($k, $v);
    }
}
コード例 #8
0
    function admin_page_output()
    {
        if (isset($_POST['dzs_custom_css_nonce']) && wp_verify_nonce($_POST['dzs_custom_css_nonce'], __FILE__) && isset($_POST['dzs_custom_css'])) {
            set_theme_mod('dzs_custom_css', $_POST['dzs_custom_css']);
        }
        $custom_css = get_theme_mod('dzs_custom_css', '');
        ?>
		<div class="wrap">
			<h2>Custom CSS</h2>

			<form method="post">
				<?php 
        submit_button();
        ?>

				<?php 
        wp_nonce_field(__FILE__, 'dzs_custom_css_nonce');
        ?>

				<textarea name="dzs_custom_css" id="dzs_custom_css"
				          style="max-width: 100%; width: 500px; height: 800px;"
				><?php 
        echo $custom_css;
        ?>
</textarea>

				<?php 
        submit_button();
        ?>
			</form>
		</div>
		<?php 
    }
コード例 #9
0
 function gdlr_add_import_action()
 {
     // setting > reading area
     update_option('show_on_front', 'page');
     update_option('page_on_front', 3720);
     update_option('page_for_posts', 0);
     // style-custom file
     if ($_POST['import-file'] == 'demo.xml') {
         $default_file = GDLR_LOCAL_PATH . '/include/function/gdlr-admin-default.txt';
         $default_admin_option = unserialize(file_get_contents($default_file));
         update_option(THEME_SHORT_NAME . '_admin_option', $default_admin_option);
         $source = get_template_directory() . '/stylesheet/style-custom-light.css';
         $destination = get_template_directory() . '/stylesheet/style-custom.css';
         copy($source, $destination);
     } else {
         if ($_POST['import-file'] == 'demo-dark.xml') {
             $default_file = GDLR_LOCAL_PATH . '/include/function/gdlr-admin-default-dark.txt';
             $default_admin_option = unserialize(file_get_contents($default_file));
             update_option(THEME_SHORT_NAME . '_admin_option', $default_admin_option);
             $source = get_template_directory() . '/stylesheet/style-custom-dark.css';
             $destination = get_template_directory() . '/stylesheet/style-custom.css';
             copy($source, $destination);
         } else {
             if ($_POST['import-file'] == 'demo-modern.xml') {
                 $default_file = GDLR_LOCAL_PATH . '/include/function/gdlr-admin-default-modern.txt';
                 $default_admin_option = unserialize(file_get_contents($default_file));
                 update_option(THEME_SHORT_NAME . '_admin_option', $default_admin_option);
                 $source = get_template_directory() . '/stylesheet/style-custom-modern.css';
                 $destination = get_template_directory() . '/stylesheet/style-custom.css';
                 copy($source, $destination);
             } else {
                 if ($_POST['import-file'] == 'demo-hostel.xml') {
                     $default_file = GDLR_LOCAL_PATH . '/include/function/gdlr-admin-default-hostel.txt';
                     $default_admin_option = unserialize(file_get_contents($default_file));
                     update_option(THEME_SHORT_NAME . '_admin_option', $default_admin_option);
                     $source = get_template_directory() . '/stylesheet/style-custom-hostel.css';
                     $destination = get_template_directory() . '/stylesheet/style-custom.css';
                     copy($source, $destination);
                 }
             }
         }
     }
     // menu to themes location
     $nav_id = 0;
     $navs = get_terms('nav_menu', array('hide_empty' => true));
     foreach ($navs as $nav) {
         if ($nav->name == 'Main menu') {
             $nav_id = $nav->term_id;
             break;
         }
     }
     set_theme_mod('nav_menu_locations', array('main_menu' => $nav_id));
     // import the widget
     $widget_file = GDLR_LOCAL_PATH . '/plugins/goodlayers-importer-widget.txt';
     $widget_data = unserialize(file_get_contents($widget_file));
     // retrieve widget data
     foreach ($widget_data as $key => $value) {
         update_option($key, $value);
     }
 }
コード例 #10
0
ファイル: test-deprecated.php プロジェクト: 1bigidea/kirki
 public function test_kirki_get_option()
 {
     $this->add_theme_mod_field();
     $this->assertEquals('foo', kirki_get_option('the_mod_option'));
     set_theme_mod('the_mod_option', 'bar');
     $this->assertEquals('bar', kirki_get_option('the_mod_option'));
 }
コード例 #11
0
function meso_import_option_into_customizer()
{
    $check_import = get_option('meso_customizer_import');
    $option_name = MESO_OPTION . '_theme_options';
    $options = get_option($option_name);
    if ($check_import != 'complete') {
        if ($options) {
            //print_r($options);
            foreach ($options as $opt => $value) {
                //echo $opt . ' = ' . $value . '<br />';
                $opt_filter = str_replace('tn_mesocolumn_', '', $opt);
                $opt_filter_tn = str_replace('tn_', '', $opt_filter);
                //lowercase the value option
                if ($value == 'Enable') {
                    $value = 'enable';
                }
                if ($value == 'Disable') {
                    $value = 'disable';
                }
                if ($value == 'Yes') {
                    $value = 'yes';
                }
                if ($value == 'No') {
                    $value = 'no';
                }
                set_theme_mod($opt_filter_tn, $value);
            }
            update_option('meso_customizer_import', 'complete');
            delete_option($option_name);
        }
    }
    //watch out! this remove all the theme mod for this theme
    //remove_theme_mods();
}
コード例 #12
0
 function set_default_mod_wpbss()
 {
     //проверяем есть ли настройка и если нет то назначаем
     if (!get_theme_mod('footer_section_3_enable')) {
         set_theme_mod('footer_section_3_enable', true);
     }
 }
コード例 #13
0
 /**
  * Refresh all currency rates
  *
  * @access public
  * @return void
  */
 public static function currencies_refresh()
 {
     $rates = get_option('realia_rates', null);
     $currencies = get_theme_mod('realia_currencies');
     $api_key = get_theme_mod('realia_currencies_jsonrates_api_key');
     $update = false;
     if ($rates == null) {
         $update = true;
     } elseif (time() - $rates['modified'] > REALIA_CURRENCY_REFRESH) {
         $update = true;
     }
     if ($update && is_array($currencies) && count($currencies) > 0 && !empty($api_key)) {
         $currency_default = $currencies[0];
         $index = 0;
         foreach ($currencies as $currency) {
             if ($index != 0) {
                 $query = sprintf('http://jsonrates.com/get/?from=%s&to=%s&apiKey=%s', $currency_default['code'], $currency['code'], $api_key);
                 $contents = @file_get_contents($query);
                 if (!empty($contents)) {
                     $json = json_decode($contents);
                     if (!empty($json)) {
                         $rate = round($json->rate, 4);
                         if (!empty($rate)) {
                             $currencies[$index]['rate'] = $rate;
                         }
                     }
                 }
             }
             $index++;
         }
         set_theme_mod('realia_currencies', $currencies);
         update_option('realia_rates', array('modified' => time()));
     }
 }
コード例 #14
0
 public function test_changed_theme_is_synced()
 {
     $theme_features = array('post-thumbnails', 'post-formats', 'custom-header', 'custom-background', 'custom-logo', 'menus', 'automatic-feed-links', 'editor-style', 'widgets', 'html5', 'title-tag', 'jetpack-social-menu', 'jetpack-responsive-videos', 'infinite-scroll', 'site-logo');
     // this forces theme mods to be saved as an option so that this test is valid
     set_theme_mod('foo', 'bar');
     $this->sender->do_sync();
     foreach ($theme_features as $theme_feature) {
         $synced_theme_support_value = $this->server_replica_storage->current_theme_supports($theme_feature);
         $this->assertEquals(current_theme_supports($theme_feature), $synced_theme_support_value, 'Feature(s) not synced' . $theme_feature);
     }
     // TODO: content_width - this has traditionally been synced as if it was a theme-specific
     // value, but in fact it's a per-page/post value defined via Jetpack's Custom CSS module
     // LEFT OUT: featured_images_enabled - a quick look inside Jetpack shows that this is equivalent
     // to 'post-thumbnails', so not worth syncing
     // theme name and options should be whitelisted as a synced option
     $this->assertEquals($this->theme, $this->server_replica_storage->get_option('stylesheet'));
     $local_value = get_option('theme_mods_' . $this->theme);
     $remote_value = $this->server_replica_storage->get_option('theme_mods_' . $this->theme);
     if (isset($local_value[0])) {
         // this is a spurious value that sometimes gets set during tests, and is
         // actively removed before sending to WPCOM
         // it appears to be due to a bug which sets array( false ) as the default value for theme_mods
         unset($local_value[0]);
     }
     $this->assertEquals($local_value, $this->server_replica_storage->get_option('theme_mods_' . $this->theme));
 }
コード例 #15
0
ファイル: customizer.php プロジェクト: jacques/wordpress
/**
 * Generate two variants of the accent color, return the original, and
 * save the others as theme mods.
 *
 * @since Twenty Fourteen 1.0
 *
 * @param string $color The original color.
 * @return string $color The original color, sanitized.
 */
function twentyfourteen_generate_accent_colors($color)
{
    $color = sanitize_hex_color($color);
    set_theme_mod('accent_lighter', twentyfourteen_adjust_color($color, 29));
    set_theme_mod('accent_much_lighter', twentyfourteen_adjust_color($color, 49));
    return $color;
}
コード例 #16
0
ファイル: functions.php プロジェクト: ssxenon01/exclusive
function exclusive_setup()
{
    add_theme_support('custom-header', array('default-image' => '', 'header-text' => false, 'wp-head-callback' => 'exclusive_header_style'));
    $exclusive_defaults = array('default-color' => 'E3E1E2', 'default-image' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '');
    add_theme_support('custom-background', $exclusive_defaults);
    if (!get_theme_mod('background_color', false)) {
        set_theme_mod('background_color', 'e3e1e2');
    }
    add_theme_support('title-tag');
    //Enable post and comments RSS feed links to head
    add_theme_support('automatic-feed-links');
    // Enable post thumbnails
    add_theme_support('post-thumbnails');
    set_post_thumbnail_size(150, 150);
    load_theme_textdomain('exclusive', get_template_directory() . '/languages');
    add_editor_style();
    global $exclusive_layout_page;
    foreach ($exclusive_layout_page->options_themeoptions as $value) {
        if (isset($value['id'])) {
            if (get_theme_mod($value['id']) === FALSE) {
                ${$value}['var_name'] = $value['std'];
            } else {
                ${$value}['var_name'] = get_theme_mod($value['id']);
            }
        }
    }
    global $content_width;
    if (!isset($content_width)) {
        $content_width = $content_area;
    }
}
コード例 #17
0
ファイル: ajax_import.php プロジェクト: syncopetwice/STG
 function us_dataImport()
 {
     if (!defined('WP_LOAD_IMPORTERS')) {
         define('WP_LOAD_IMPORTERS', true);
     }
     require_once get_template_directory() . '/vendor/wordpress-importer/wordpress-importer.php';
     if (!is_file(get_template_directory() . '/xml/demo_data.xml')) {
         echo "Automatic import failed. Please use the wordpress importer and import the XML file (Astra/xml/demo_data.xml) manually.";
     } else {
         $wp_import = new WP_Import();
         $wp_import->fetch_attachments = true;
         $wp_import->import(get_template_directory() . '/xml/demo_data.xml');
         // Set menu
         $locations = get_theme_mod('nav_menu_locations');
         $menus = wp_get_nav_menus();
         if (!empty($menus)) {
             foreach ($menus as $menu) {
                 if (is_object($menu) && $menu->name == 'Astra Main Menu') {
                     $locations['astra_main_menu'] = $menu->term_id;
                 }
                 if (is_object($menu) && $menu->name == 'Astra Footer Menu') {
                     $locations['astra_footer_menu'] = $menu->term_id;
                 }
             }
         }
         set_theme_mod('nav_menu_locations', $locations);
     }
     die;
 }
コード例 #18
0
/**
 * Changes display_header_text to not show by default 
 * the first time this is run. (Wordpress checks 
 * header_textcolor to be 'blank' when deciding to
 * show or not show header text.)
 */
function change_header_text_default()
{
    if (get_option('default_display_header_text_changed') != true) {
        set_theme_mod('header_textcolor', 'blank');
        update_option('default_display_header_text_changed', true);
    }
}
コード例 #19
0
ファイル: functions.php プロジェクト: jhersonn20/www
function exclusive_setup()
{
    add_theme_support('custom-header', array('default-image' => '', 'header-text' => false, 'wp-head-callback' => 'exclusive_header_style'));
    $exclusive_defaults = array('default-color' => 'E3E1E2', 'default-image' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '');
    add_theme_support('custom-background', $exclusive_defaults);
    if (!get_theme_mod('background_color', false)) {
        set_theme_mod('background_color', 'e3e1e2');
    }
    load_theme_textdomain('wd_exclusive', get_template_directory() . '/languages');
    add_editor_style();
    global $exclusive_layout_page;
    foreach ($exclusive_layout_page->options_themeoptions as $value) {
        if (isset($value['id'])) {
            if (get_theme_mod($value['id']) === FALSE) {
                ${$value}['var_name'] = $value['std'];
            } else {
                ${$value}['var_name'] = get_theme_mod($value['id']);
            }
        }
    }
    global $content_width;
    if (!isset($content_width)) {
        $content_width = $content_area;
    }
}
コード例 #20
0
ファイル: navigation.php プロジェクト: guimachiavelli/vac
 private static function setup()
 {
     $menu_id = wp_create_nav_menu(self::$description);
     $locations = get_theme_mod('nav_menu_locations');
     $locations['main-nav'] = $menu_id;
     set_theme_mod('nav_menu_locations', $locations);
 }
コード例 #21
0
ファイル: menus.php プロジェクト: shads196770/cbox-theme
/**
 * Register and create a custom BuddyPress menu
 */
function infinity_register_bp_menu($menu_name)
{
    global $blog_id;
    // check BP reqs and if our custom default menu already exists
    if (function_exists('bp_core_get_directory_pages') && BP_ROOT_BLOG == $blog_id && !is_nav_menu($menu_name)) {
        // doesn't exist, create it
        $menu_id = wp_create_nav_menu($menu_name);
        // get bp pages
        $pages = bp_core_get_directory_pages();
        // allowed pages
        $pages_ok = array('activity' => true, 'blogs' => true, 'forums' => true, 'groups' => true, 'links' => true, 'members' => true);
        // loop all pages
        foreach ($pages as $config) {
            // make sure we support this page
            if (array_key_exists($config->name, $pages_ok)) {
                // yep, add page as a nav item
                wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'post_type', 'menu-item-status' => 'publish', 'menu-item-object' => 'page', 'menu-item-object-id' => $config->id, 'menu-item-title' => $config->title, 'menu-item-attr-title' => $config->title, 'menu-item-classes' => 'icon-' . $config->name));
            }
        }
        // get location settings
        $locations = get_theme_mod('nav_menu_locations');
        // is main menu location set yet?
        if (empty($locations['main-menu'])) {
            // nope, set it
            $locations['main-menu'] = $menu_id;
            // update theme mode
            set_theme_mod('nav_menu_locations', $locations);
        }
    }
}
コード例 #22
0
function set_top_menu_on_import()
{
    $menu_seted = get_option('menus_seted');
    if (false == $menu_seted) {
        $menu_seted = 0;
    }
    if (2 >= get_option('menus_seted')) {
        $menus = get_terms('nav_menu');
        $menu_seted++;
        $save = array();
        foreach ($menus as $menu) {
            if ($menu->name == 'Shop menu') {
                $save['shop_menu'] = $menu->term_id;
            } elseif ($menu->name == 'Header Menu') {
                $save['header_menu'] = $menu->term_id;
            } elseif ($menu->name == 'Footer Menu') {
                $save['footer_menu'] = $menu->term_id;
            }
        }
        if ($save) {
            remove_theme_mod('nav_menu_locations');
            set_theme_mod('nav_menu_locations', array_map('absint', $save));
        }
        update_option('menus_seted', $menu_seted);
    }
}
コード例 #23
0
ファイル: color_control.php プロジェクト: scarykay/bsf
 public function web_dorado_theme_update_and_get_options_color_control()
 {
     if (isset($_GET['page']) && $_GET['page'] == "web_dorado_theme" && isset($_GET['controller']) && $_GET['controller'] == "color_control_page") {
         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'save') {
             foreach ($this->options_colorcontrol as $value) {
                 set_theme_mod($value['id'], $_REQUEST[$value['var_name']]);
             }
             foreach ($this->options_colorcontrol as $value) {
                 if (isset($_REQUEST[$value['var_name']])) {
                     set_theme_mod($value['id'], $_REQUEST[$value['var_name']]);
                 } else {
                     remove_theme_mod($value['id']);
                 }
             }
             header("Location: themes.php?page=web_dorado_theme&controller=color_control_page&saved=true");
             die;
         } else {
             if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset') {
                 foreach ($this->options_colorcontrol as $value) {
                     remove_theme_mod($value['id']);
                 }
                 header("Location: themes.php?page=web_dorado_theme&controller=color_control_page&reset=true");
                 die;
             }
         }
     }
 }
コード例 #24
0
ファイル: menu-walkers.php プロジェクト: yarylo/cerkva.pp.ua
function wptouch_initialize_wordpress_menus()
{
    if (!get_option('wptouch_menus_initialized')) {
        global $wptouch_pro;
        foreach ($wptouch_pro->theme_menus as $menu) {
            $location = $menu->setting_name;
            $menu_domain = $menu->settings_domain;
            $settings = wptouch_get_settings($menu_domain);
            if ($settings->{$location} == 'wp') {
                $menu_id = wptouch_migrate_modded_menu();
                $settings->{$location} = $menu_id;
                $settings->save();
            }
        }
        $menu_map = get_theme_mod('nav_menu_locations');
        foreach ($wptouch_pro->theme_menus as $menu) {
            $location = $menu->setting_name;
            $menu_domain = $menu->settings_domain;
            $settings = wptouch_get_settings($menu_domain);
            if ($settings->{$location} && $settings->{$location} != '') {
                $menu_map['wptouch_' . $location] = $settings->{$location};
            }
        }
        set_theme_mod('nav_menu_locations', $menu_map);
        add_option('wptouch_menus_initialized', true);
    }
}
コード例 #25
0
ファイル: init.php プロジェクト: renatodex/submundo-blogstore
 /**
  * Add menus
  *
  * @since 0.0.1
  */
 public function set_demo_menus()
 {
     // Menus to Import and assign - you can remove or add as many as you want
     //$top_menu = get_term_by('name', 'Top menu', 'nav_menu');
     $main_menu = get_term_by('name', 'Primary Menu', 'nav_menu');
     //$mobile_menu = get_term_by('name', 'Mobile Menu', 'nav_menu');
     set_theme_mod('nav_menu_locations', array('primary' => $main_menu->term_id));
 }
コード例 #26
0
 /**
  * Add menus
  *
  * @since 0.0.1
  */
 public function set_demo_menus()
 {
     // Menus to Import and assign - you can remove or add as many as you want
     $top_menu = get_term_by('name', 'Top Menu', 'nav_menu');
     $main_menu = get_term_by('name', 'Main Menu', 'nav_menu');
     $footer_menu = get_term_by('name', 'Main Menu', 'nav_menu');
     set_theme_mod('nav_menu_locations', array('top-menu' => $top_menu->term_id, 'primary' => $main_menu->term_id, 'footer-menu' => $footer_menu->term_id));
 }
コード例 #27
0
 protected function __construct()
 {
     $this->include_required_files();
     // add_action( 'tgmpa_register', array( $this, 'require_plugins' ) );
     if (!get_theme_mod('squarely_version', false)) {
         set_theme_mod('squarely_version', $this->version);
     }
 }
コード例 #28
-1
function ac_activation_setup_menus()
{
    // Create the menu
    $roots_nav_theme_mod = false;
    $primary_nav = wp_get_nav_menu_object('Primary Navigation');
    if (!$primary_nav) {
        $primary_nav_id = wp_create_nav_menu('Primary Navigation', array('slug' => 'primary_navigation'));
        $roots_nav_theme_mod['primary_navigation'] = $primary_nav_id;
    } else {
        $roots_nav_theme_mod['primary_navigation'] = $primary_nav->term_id;
    }
    if ($roots_nav_theme_mod) {
        set_theme_mod('nav_menu_locations', $roots_nav_theme_mod);
    }
    // Add the pages to the menu
    $primary_nav = wp_get_nav_menu_object('Primary Navigation');
    $primary_nav_term_id = (int) $primary_nav->term_id;
    $menu_items = wp_get_nav_menu_items($primary_nav_term_id);
    if (!$menu_items || empty($menu_items)) {
        $pages = get_pages();
        foreach ($pages as $page) {
            $item = array('menu-item-object-id' => $page->ID, 'menu-item-object' => 'page', 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish');
            wp_update_nav_menu_item($primary_nav_term_id, 0, $item);
        }
    }
}
コード例 #29
-1
ファイル: custom-css.php プロジェクト: GTACSolutions/Telios
 /**
  * Generate custom CSS when save theme options
  *
  * @return void
  */
 function generate_css()
 {
     // Update last time saved
     set_theme_mod('last_saved', time());
     $css = '';
     $css .= $this->design_custom_css();
     $css .= $this->custom_color_scheme();
     // Write custom CSS to static file
     $dir = $this->get_dir();
     $file = $dir . $this->file;
     if ($css) {
         wp_mkdir_p($dir);
         // Create directory if it doesn't exists
         // Getting credentials
         $url = wp_nonce_url('themes.php?page=theme-options');
         if (false === ($creds = request_filesystem_credentials($url, '', false, false, null))) {
             return;
         }
         // Try to get the wp_filesystem running
         if (!WP_Filesystem($creds)) {
             // Ask the user for them again
             request_filesystem_credentials($url, '', true, false, null);
             return;
         }
         global $wp_filesystem;
         $wp_filesystem->put_contents($file, $css, FS_CHMOD_FILE);
     } else {
         // Remove file and directory
         @unlink($file);
         @rmdir($dir);
     }
 }
コード例 #30
-1
 public function set_header_preset($newpreset_title, $newpreset_settings)
 {
     // Update attribute array with a new value
     $this->header_design_presets[$newpreset_title] = $newpreset_settings;
     // Update header presets in the database
     set_theme_mod('lbmn_header_preset', serialize($this->header_design_presets));
 }