本文整理汇总了PHP中get_theme_mods函数的典型用法代码示例。如果您正苦于以下问题:PHP get_theme_mods函数的具体用法?PHP get_theme_mods怎么用?PHP get_theme_mods使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_theme_mods函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: jim_styles
function jim_styles()
{
wp_enqueue_style('custom_style', get_template_directory_uri() . '/css/global.css');
$mods = get_theme_mods();
// var_dump($mods);
$p_color = get_theme_mod('color_setting');
$styles = '
body { color:' . $p_color . ';}
body p { color: ' . $p_color . ';}
body h1 { color:' . $mods['h1_color'] . ' }
body h2 { color:' . $mods['h2_color'] . ' }
body h3 { color:' . $mods['h3_color'] . ' }
body h4 { color:' . $mods['h4_color'] . ' }
body h5 { color:' . $mods['h5_color'] . ' }
';
wp_add_inline_style('custom_style', $styles);
}
开发者ID:jimsheen,项目名称:jims-blank-wordpress-theme,代码行数:17,代码来源:scripts.php
示例2: wpo_init_constants
function wpo_init_constants()
{
$theme_mods = get_theme_mods();
if (!defined('TEMPLATEURI')) {
define('TEMPLATEURI', trailingslashit(get_stylesheet_directory_uri()));
}
if (!defined('HOMEURL')) {
define('HOMEURL', trailingslashit(get_home_url()));
}
if (!defined('THEMECOLOR')) {
if (!empty($theme_mods['wpo_theme_color'])) {
$meta_color = $theme_mods['wpo_theme_color'];
} else {
$meta_color = '#000000';
}
define('THEMECOLOR', $meta_color);
}
if (!defined('HEADERCOLOR')) {
if (!empty($theme_mods['wpo_header_color'])) {
$meta_color = $theme_mods['wpo_header_color'];
} else {
$meta_color = '#000000';
}
define('HEADERCOLOR', $meta_color);
}
}
开发者ID:bigandy,项目名称:wp-offline,代码行数:26,代码来源:misc.php
示例3: customcss
function customcss()
{
$thim_options = get_theme_mods();
$custom_css = '';
if (isset($thim_options['thim_user_bg_pattern']) && $thim_options['thim_user_bg_pattern'] == '1') {
$custom_css .= ' body{background-image: url("' . $thim_options['thim_bg_pattern'] . '"); }';
}
if (isset($thim_options['thim_bg_pattern_upload']) && $thim_options['thim_bg_pattern_upload'] != '') {
$bg_body = wp_get_attachment_image_src($thim_options['thim_bg_pattern_upload'], 'full');
$custom_css .= ' body{background-image: url("' . $bg_body[0] . '"); }
body{
background-repeat: ' . $thim_options['thim_bg_repeat'] . ';
background-position: ' . $thim_options['thim_bg_position'] . ';
background-attachment: ' . $thim_options['thim_bg_attachment'] . ';
background-size: ' . $thim_options['thim_bg_size'] . ';
}
';
}
/* Footer */
// Background
if (isset($thim_options['thim_footer_background_img']) && $thim_options['thim_footer_background_img']) {
$bg_footer = wp_get_attachment_image_src($thim_options['thim_footer_background_img'], 'full');
$custom_css .= 'footer#colophon {background-image: url("' . $bg_footer[0] . '");
}';
}
$custom_css .= $thim_options['thim_custom_css'];
return $custom_css;
}
开发者ID:vinhnq1211,项目名称:funy,代码行数:28,代码来源:theme-options-to-css.php
示例4: set_theme_mods
/**
* Update theme modifications for the current theme.
* Note: Candidate core function.
* http://core.trac.wordpress.org/ticket/20091
*
* @since 3.4.0
*
* @param array $mods Theme modifications.
*/
public function set_theme_mods($mods)
{
$current = get_theme_mods();
$mods = wp_parse_args($mods, $current);
$theme = get_stylesheet();
update_option("theme_mods_{$theme}", $mods);
}
开发者ID:radman,项目名称:noobyo-blog,代码行数:16,代码来源:class-wp-customize.php
示例5: get_context
/**
* Custom implementation for get_context method.
*/
public function get_context()
{
global $content_width;
if (class_exists('Easy_Digital_Downloads')) {
global $edd_options;
}
$context = Timber::get_context();
$sidebar_primary = Timber::get_widgets('sidebar_primary');
$sidebar_footer = Timber::get_widgets('sidebar_footer');
$context['theme_mods'] = get_theme_mods();
$context['site_options'] = wp_load_alloptions();
$context['teaser_mode'] = apply_filters('maera/teaser/mode', 'excerpt');
$context['thumbnail']['width'] = apply_filters('maera/image/width', 600);
$context['thumbnail']['height'] = apply_filters('maera/image/height', 371);
$context['menu']['primary'] = has_nav_menu('primary_navigation') ? new TimberMenu('primary_navigation') : null;
$context['sidebar']['primary'] = apply_filters('maera/sidebar/primary', $sidebar_primary);
$context['sidebar']['footer'] = apply_filters('maera/sidebar/footer', $sidebar_footer);
$context['pagination'] = Timber::get_pagination();
$context['comment_form'] = TimberHelper::get_comment_form();
$context['comments_args'] = array('style' => 'ul', 'reply_text' => __('Reply', 'maera'), 'short_ping' => true, 'avatar_size' => 60);
$context['site_logo'] = get_option('site_logo', false);
$context['content_width'] = $content_width;
$context['sidebar_template'] = maera_templates_sidebar();
if (class_exists('Easy_Digital_Downloads')) {
$data['edd_options'] = $edd_options;
$data['download_categories'] = Timber::get_terms('download_category');
$data['download_tags'] = Timber::get_terms('download_tag');
$data['default_image'] = new TimberImage(get_template_directory_uri() . '/assets/images/default.png');
}
return apply_filters('maera/timber/context', $context);
}
开发者ID:wpmu,项目名称:maera,代码行数:34,代码来源:class-maera-timber.php
示例6: export_customizer_options
public function export_customizer_options()
{
$mods = get_theme_mods();
unset($mods['nav_menu_locations']);
$output = base64_encode(serialize($mods));
$this->save_as_txt_file("customizer_options.txt", $output);
}
开发者ID:novichkovv,项目名称:prlab,代码行数:7,代码来源:export.php
示例7: add_to_context
function add_to_context($context)
{
$context['foo'] = 'bar';
$context['stuff'] = 'I am a value set in your functions.php file';
$context['notes'] = 'These values are available everytime you call Timber::get_context();';
$context['menu'] = new TimberMenu();
//$context['custom_wp_nav_menu'] = wp_nav_menu( array( 'container_class' => 'menu-header', 'echo' => false, 'menu_class' => 'nav-menu' ) );
$context['custom_wp_nav_menu'] = wp_nav_menu(array('container_class' => 'menu-header', 'echo' => false, 'menu_class' => 'nav-menu'));
$context['site'] = $this;
$context['theme_url'] = get_stylesheet_directory_uri();
$context['is_logged_in'] = is_user_logged_in();
$context['theme_mod'] = get_theme_mods();
$context['options'] = wp_load_alloptions();
$context['site_url'] = site_url();
if (is_home() || is_front_page()) {
$context['is_home'] = true;
}
/*
* Footer
*/
$context['footer_tag_line'] = get_option('footer_text');
$context['footer_address'] = get_option('address');
$context['footer_site_url'] = site_url();
$context['footer_inquiry_mail'] = get_option('inquiry_mail');
$context['footer_telephone'] = get_option('telephone');
$context['s_facebook'] = get_option('facebook');
$context['s_twitter'] = get_option('twitter');
$context['s_linkedin'] = get_option('linkedin');
$context['footer_copyright'] = get_option('copyright');
return $context;
}
开发者ID:sumeetgohel1990,项目名称:triangle,代码行数:31,代码来源:functions.php
示例8: get_theme_mod_value
/**
* Get theme mod value.
*
* @param string $value
* @return string
*/
public function get_theme_mod_value($value)
{
$key = substr(current_filter(), 10);
$set_theme_mods = get_theme_mods();
if (isset($set_theme_mods[$key])) {
return $value;
}
$values = $this->get_storefront_default_setting_values();
return isset($values[$key]) ? $values[$key] : $value;
}
开发者ID:nishitlangaliya,项目名称:storefront,代码行数:16,代码来源:class-storefront-customizer.php
示例9: octopus_header_style
/**
* Styles the header image and text displayed on the blog.
*
* @see octopus_custom_header_setup().
*/
function octopus_header_style()
{
$header_text_color = get_header_textcolor();
// If no custom options are set, let's bail.
if (!get_theme_mods()) {
return;
}
// If we get this far, we have custom styles. Let's do this.
?>
<style type="text/css" id="octopus-custom-style">
<?php
/*
* If no custom options for text are set, let's bail.
* get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: HEADER_TEXTCOLOR.
*/
if (!HEADER_TEXTCOLOR === $header_text_color) {
// Has the text been hidden?
if (!display_header_text()) {
?>
.site-title,
.site-description {
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
}
<?php
// If the user has set a custom color for the text use that.
} else {
?>
.site-title a,
.site-description {
color: #<?php
echo esc_attr($header_text_color);
?>
;
}
<?php
}
?>
<?php
}
?>
<?php
octopus_generate_css('#page.container', 'max-width', 'container_max_width', '', '', true);
//Header
octopus_generate_css('.container-fluid .octopus-wrapper', 'max-width', 'wrapped_element_max_width', '', 'px', true);
// Header banner
octopus_generate_css('.octopus-header-banner', 'height', 'header_banner_height', '', 'px', true);
?>
</style>
<?php
}
开发者ID:Almalerik,项目名称:octopus,代码行数:57,代码来源:custom-header.php
示例10: thememove_customizer_options_exporter
function thememove_customizer_options_exporter()
{
$blogname = strtolower(str_replace(' ', '-', get_option('blogname')));
$file_name = $blogname . '-thememove-' . date('Ydm') . '.txt';
$options = get_theme_mods();
unset($options['nav_menu_locations']);
ob_clean();
header("Content-type: application/text", true, 200);
header("Content-Disposition: attachment; filename=\"{$file_name}\"");
header("Pragma: no-cache");
header("Expires: 0");
echo base64_encode(serialize($options));
die;
}
开发者ID:novichkovv,项目名称:prlab,代码行数:14,代码来源:export.php
示例11: import_skin_from_file
protected function import_skin_from_file($file)
{
$content = $this->get_file_contents($file);
$options = @unserialize(base64_decode($content));
foreach ((array) $options as $key => $val) {
set_theme_mod($key, $val);
}
$mods = get_theme_mods();
foreach ($mods as $mod_key => $mod_valud) {
if ('nav_menu_locations' != $mod_key && !isset($options[$mod_key])) {
remove_theme_mod($mod_key);
}
}
}
开发者ID:Neminath,项目名称:lastmile,代码行数:14,代码来源:class-tm-customizer-skin-manager.php
示例12: of_get_options
/**
* Get options from the database and process them with the load filter hook.
*
* @author Jonah Dahlquist
* @since 1.4.0
* @return array
*/
function of_get_options($key = null, $data = null)
{
do_action('of_get_options_before', array('key' => $key, 'data' => $data));
if ($key != null) {
// Get one specific value
$data = get_theme_mod($key, $data);
} else {
// Get all values
$data = get_theme_mods();
}
$data = apply_filters('of_options_after_load', $data);
do_action('of_option_setup_before', array('key' => $key, 'data' => $data));
return $data;
}
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:21,代码来源:functions.admin.php
示例13: customize_save
/**
* Hooks into the customize_save action to save modifications in theme_options/mods
*/
public function customize_save(\WP_Customize_Manager $manager)
{
foreach ($manager->settings() as $key => $setting) {
if ($setting->type == 'theme_mod') {
// We have to call this early to make sure it is saved
$setting->save();
}
}
$mods = get_theme_mods();
if ($mods) {
ksort($mods);
static::writeConfigs("theme_options/mods", array('mods' => $mods));
}
}
开发者ID:wemakecustom,项目名称:wp-config-manager,代码行数:17,代码来源:ThemeOptions.php
示例14: thim_customizer_export_theme_settings
function thim_customizer_export_theme_settings()
{
$blogname = strtolower(str_replace(' ', '-', get_option('blogname')));
$file_name = $blogname . '-thimtheme-' . date('Ydm') . '.json';
$options = get_theme_mods();
unset($options['nav_menu_locations']);
foreach ($options as $key => $value) {
$value = maybe_unserialize($value);
$need_options[$key] = $value;
}
$json_file = json_encode($need_options);
ob_clean();
header('Content-Type: text/json; charset=' . get_option('blog_charset'));
header('Content-Disposition: attachment; filename="' . $file_name . '"');
echo ent2ncr($json_file);
exit;
}
开发者ID:vinhnq1211,项目名称:funy,代码行数:17,代码来源:export-settings.php
示例15: x_version_migration
function x_version_migration()
{
$prior = get_option('x_version', '1.0.0');
if (version_compare($prior, X_VERSION, '<')) {
//
// If $prior is less than 2.2.0.
//
if (version_compare($prior, '2.2.0', '<')) {
$mods = get_theme_mods();
foreach ($mods as $key => $value) {
update_option($key, $value);
}
}
//
// If $prior is less than 3.1.0.
//
if (version_compare($prior, '3.1.0', '<')) {
$stack = get_option('x_stack');
$design = $stack == 'integrity' ? '_' . get_option('x_integrity_design') : '';
$stack_safe = $stack == 'icon' ? 'integrity' : $stack;
$updated = array('x_layout_site' => get_option('x_' . $stack . '_layout_site'), 'x_layout_site_max_width' => get_option('x_' . $stack . '_sizing_site_max_width'), 'x_layout_site_width' => get_option('x_' . $stack . '_sizing_site_width'), 'x_layout_content' => get_option('x_' . $stack . '_layout_content'), 'x_layout_content_width' => get_option('x_' . $stack_safe . '_sizing_content_width'), 'x_layout_sidebar_width' => get_option('x_icon_sidebar_width'), 'x_design_bg_color' => get_option('x_' . $stack . $design . '_bg_color'), 'x_design_bg_image_pattern' => get_option('x_' . $stack . $design . '_bg_image_pattern'), 'x_design_bg_image_full' => get_option('x_' . $stack . $design . '_bg_image_full'), 'x_design_bg_image_full_fade' => get_option('x_' . $stack . $design . '_bg_image_full_fade'));
foreach ($updated as $key => $value) {
update_option($key, $value);
}
}
//
// If $prior is less than 4.0.0.
//
if (version_compare($prior, '4.0.0', '<')) {
$updated = array('x_pre_v4' => true);
foreach ($updated as $key => $value) {
update_option($key, $value);
}
}
//
// Update stored version number.
//
update_option('x_version', X_VERSION);
//
// Turn on the version migration notice.
//
update_option('x_version_migration_notice', true);
}
}
开发者ID:ju4nr3v0l,项目名称:juandavidmarulanda.com,代码行数:44,代码来源:migration.php
示例16: brawny_customizer_setup
function brawny_customizer_setup()
{
if (count(get_theme_mods()) <= 1) {
global $options;
$brawny = get_option('brawny');
foreach ($options['panels']['theme_options']['sections'] as $section) {
foreach ($section['fields'] as $name => $settings) {
//echo 'Name: ' . $name . '<br>' . 'Value: ' . $brawny[$name] . '<br>';
if (!get_theme_mod($name) && isset($brawny[$name])) {
if (is_array($brawny[$name])) {
set_theme_mod($name, $brawny[$name]['url']);
} else {
set_theme_mod($name, $brawny[$name]);
}
}
}
}
foreach ($options['panels']['home']['sections'] as $section) {
foreach ($section['fields'] as $name => $settings) {
if (!get_theme_mod($name) && isset($brawny[$name])) {
if (is_array($brawny[$name])) {
set_theme_mod($name, $brawny[$name]['url']);
} else {
set_theme_mod($name, $brawny[$name]);
}
}
if (isset($brawny['slides'])) {
$slide_count = 1;
foreach ($brawny['slides'] as $slide) {
if (!get_theme_mod('image_upload-' . $slide_count) && isset($slide['image'])) {
set_theme_mod('image_upload-' . $slide_count, $slide['image']);
}
if (!get_theme_mod('flexcaption-' . $slide_count) && isset($slide['description'])) {
set_theme_mod('flexcaption-' . $slide_count, $slide['description']);
}
$slide_count++;
}
}
}
}
}
}
开发者ID:diptigandhi24,项目名称:Trade-Bucket-Global,代码行数:42,代码来源:functions.php
示例17: ttfmake_customizer_convert_theme_mods_filter
/**
* Convert a new theme mod value from an old one.
*
* @since 1.3.0.
*
* @param mixed $value The current value.
* @return mixed The modified value.
*/
function ttfmake_customizer_convert_theme_mods_filter($value)
{
$new_mod_name = str_replace('theme_mod_', '', current_filter());
$conversions = ttfmake_customizer_get_key_conversions();
$mods = get_theme_mods();
/**
* When previewing a page, the logic for this filter needs to change. Because the isset check in the conditional
* below will always fail if the new mod key is not set (i.e., the value isn't in the db yet), the default value,
* instead of the preview value will always show. Instead, when previewing, the value needs to be gotten from
* the `get_theme_mod()` call without this filter applied. This will give the new preview value. If it is not found,
* then the normal routine will be used.
*/
if (ttfmake_is_preview()) {
remove_filter(current_filter(), 'ttfmake_customizer_convert_theme_mods_filter', 11);
$previewed_value = get_theme_mod($new_mod_name, 'default-value');
add_filter(current_filter(), 'ttfmake_customizer_convert_theme_mods_filter', 11);
if ('default-value' !== $previewed_value) {
return $previewed_value;
}
}
/**
* We only want to convert the value if the new mod is not in the mods array. This means that the value is not set
* and an attempt to get the value from an old key is warranted.
*/
if (!isset($mods[$new_mod_name])) {
// Verify that this key should be converted
if (isset($conversions[$new_mod_name])) {
$old_mod_name = $conversions[$new_mod_name];
$old_mod_value = get_theme_mod($old_mod_name, 'default-value');
// The old value is indeed set
if ('default-value' !== $old_mod_value) {
$value = $old_mod_value;
// Now that we have the right old value, convert it if needed
$value = ttfmake_customizer_convert_theme_mods_values($old_mod_name, $new_mod_name, $value);
}
}
}
return $value;
}
开发者ID:marceloroberto,项目名称:make,代码行数:47,代码来源:compatibility.php
示例18: getStyleOptions
public function getStyleOptions($customizeMode = false)
{
//getting all theme mods
$result = $themeMods = get_theme_mods();
if ($customizeMode) {
$updatedOptions = isset($_POST['customized']) ? json_decode(wp_unslash($_POST['customized']), true) : null;
if ($updatedOptions) {
foreach ($updatedOptions as $optionName => $value) {
$result[$optionName] = get_theme_mod($optionName);
}
}
}
$theme_cusomizer = adventure_tours_di('theme_customizer');
$font_options = $theme_cusomizer->getFontFamilySettings();
if ($font_options) {
foreach ($font_options as $option_name) {
if (!isset($result[$option_name])) {
$result[$option_name] = $theme_cusomizer->getFontSettingDefaults($option_name);
}
}
}
return $result;
}
开发者ID:j-kenneth,项目名称:Expeero,代码行数:23,代码来源:AtApplication.php
示例19: get
/**
* Get one or more theme mods.
*
* ## OPTIONS
*
* [<mod>...]
* : One or more mods to get.
*
* [--all]
* : List all theme mods
*
* [--format=<format>]
* : Render output in a particular format.
* ---
* default: table
* options:
* - table
* - json
* - csv
* - yaml
* ---
*
* ## EXAMPLES
*
* # Get all theme mods
* $ wp theme mod get --all
* +------------------+---------+
* | key | value |
* +------------------+---------+
* | background_color | dd3333 |
* | link_color | #dd9933 |
* | main_text_color | #8224e3 |
* +------------------+---------+
*
* # Get single theme mod in JSON format
* $ wp theme mod get background_color --format=json
* [{"key":"background_color","value":"dd3333"}]
*
* # Get multiple theme mods
* $ wp theme mod get background_color header_textcolor
* +------------------+--------+
* | key | value |
* +------------------+--------+
* | background_color | dd3333 |
* | header_textcolor | |
* +------------------+--------+
*/
public function get($args = array(), $assoc_args = array())
{
if (!\WP_CLI\Utils\get_flag_value($assoc_args, 'all') && empty($args)) {
WP_CLI::error("You must specify at least one mod or use --all.");
}
if (\WP_CLI\Utils\get_flag_value($assoc_args, 'all')) {
$args = array();
}
$list = array();
$mods = get_theme_mods();
if (!is_array($mods)) {
// if no mods are set (perhaps new theme), make sure foreach still works
$mods = array();
}
foreach ($mods as $k => $v) {
// if mods were given, skip the others
if (!empty($args) && !in_array($k, $args)) {
continue;
}
if (is_array($v)) {
$list[] = array('key' => $k, 'value' => '=>');
foreach ($v as $_k => $_v) {
$list[] = array('key' => " {$_k}", 'value' => $_v);
}
} else {
$list[] = array('key' => $k, 'value' => $v);
}
}
// For unset mods, show blank value
foreach ($args as $mod) {
if (!isset($mods[$mod])) {
$list[] = array('key' => $mod, 'value' => '');
}
}
$formatter = new \WP_CLI\Formatter($assoc_args, array('key', 'value'), 'thememods');
$formatter->display_items($list);
}
开发者ID:wp-cli,项目名称:wp-cli,代码行数:84,代码来源:theme-mod.php
示例20: kirki_get_option
/**
* Get the value of a field.
*/
function kirki_get_option($option = '')
{
// Make sure the class is instanciated
Kirki::get_instance();
// Get the array of all the fields.
$fields = Kirki::fields()->get_all();
// Get the config.
$config = Kirki::config()->get_all();
/**
* If no setting has been defined then return all.
*/
if ('' == $option) {
if ('option' == $config['options_type']) {
$values = array();
foreach ($fields as $field) {
$values[] = get_option($field['settings'], $field['default']);
}
} else {
$values = get_theme_mods();
}
return $values;
}
// If a value has been defined then we proceed.
// Early exit if this option does not exist
if (!isset($fields[$option])) {
return;
}
$option_name = $fields[$option]['settings'];
$default = $fields[$option]['default'];
if ('option' == $config['options_type']) {
$value = get_option($option_name, $default);
} else {
$value = get_theme_mod($option_name, $default);
}
return $value;
}
开发者ID:IlhamFS,项目名称:wordpress,代码行数:39,代码来源:helpers.php
注:本文中的get_theme_mods函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论