本文整理汇总了PHP中set_theme_mod函数的典型用法代码示例。如果您正苦于以下问题:PHP set_theme_mod函数的具体用法?PHP set_theme_mod怎么用?PHP set_theme_mod使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_theme_mod函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wedding_style_setup
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'];
}
}
}
开发者ID:javalidigital,项目名称:multipla,代码行数:25,代码来源:functions.php
示例2: wf_theme_import_demo_menus
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));
}
开发者ID:brandmobility,项目名称:kikbak,代码行数:7,代码来源:import-demo.php
示例3: xt_install_menu
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);
}
}
开发者ID:aspirin,项目名称:wp-xintaoke,代码行数:31,代码来源:xt-installer-functions.php
示例4: set_demo_menus
/**
* 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));
}
开发者ID:mertyildiran,项目名称:grandinsaat,代码行数:12,代码来源:init.php
示例5: kirki_update
/**
* 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);
}
}
开发者ID:IlhamFS,项目名称:wordpress,代码行数:31,代码来源:helpers.php
示例6: web_dorado_theme_update_and_get_options_typography
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;
}
}
}
}
开发者ID:roundtopdog,项目名称:wordpress,代码行数:28,代码来源:typography_page.php
示例7: floki_default_options
function floki_default_options()
{
$defaults = floki_get_option_defaults();
foreach ($defaults as $k => $v) {
set_theme_mod($k, $v);
}
}
开发者ID:Matwilk,项目名称:wordpress,代码行数:7,代码来源:functions.php
示例8: admin_page_output
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
}
开发者ID:TheDetroitZoo,项目名称:custom-css,代码行数:33,代码来源:dzs-custom-css.php
示例9: gdlr_add_import_action
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);
}
}
开发者ID:hoa32811,项目名称:wp_thanhtrung_hotel,代码行数:60,代码来源:goodlayers-importer.php
示例10: test_kirki_get_option
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'));
}
开发者ID:1bigidea,项目名称:kirki,代码行数:7,代码来源:test-deprecated.php
示例11: meso_import_option_into_customizer
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();
}
开发者ID:jun200,项目名称:wordpress,代码行数:34,代码来源:customizer-functions.php
示例12: set_default_mod_wpbss
function set_default_mod_wpbss()
{
//проверяем есть ли настройка и если нет то назначаем
if (!get_theme_mod('footer_section_3_enable')) {
set_theme_mod('footer_section_3_enable', true);
}
}
开发者ID:tanzoor,项目名称:wpbss,代码行数:7,代码来源:customizer-footer-s3.php
示例13: currencies_refresh
/**
* 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()));
}
}
开发者ID:jhonrsalcedo,项目名称:sitio,代码行数:40,代码来源:class-realia-currencies.php
示例14: test_changed_theme_is_synced
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));
}
开发者ID:iamtakashi,项目名称:jetpack,代码行数:26,代码来源:test_class.jetpack-sync-themes.php
示例15: twentyfourteen_generate_accent_colors
/**
* 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;
}
开发者ID:jacques,项目名称:wordpress,代码行数:16,代码来源:customizer.php
示例16: exclusive_setup
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;
}
}
开发者ID:ssxenon01,项目名称:exclusive,代码行数:31,代码来源:functions.php
示例17: us_dataImport
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;
}
开发者ID:syncopetwice,项目名称:STG,代码行数:29,代码来源:ajax_import.php
示例18: change_header_text_default
/**
* 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);
}
}
开发者ID:quantegy,项目名称:wp-genesis-child-theme,代码行数:13,代码来源:functions_logo.php
示例19: exclusive_setup
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;
}
}
开发者ID:jhersonn20,项目名称:www,代码行数:25,代码来源:functions.php
示例20: setup
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);
}
开发者ID:guimachiavelli,项目名称:vac,代码行数:7,代码来源:navigation.php
注:本文中的set_theme_mod函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论