本文整理汇总了PHP中sh_set函数的典型用法代码示例。如果您正苦于以下问题:PHP sh_set函数的具体用法?PHP sh_set怎么用?PHP sh_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sh_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sh_widget_init
function sh_widget_init()
{
global $wp_registered_sidebars;
$theme_options = _WSH()->option();
//if( class_exists( 'SH_About_Us' ) )register_widget( 'SH_About_Us' );
if (class_exists('SH_Contact_Info')) {
register_widget('SH_Contact_Info');
}
if (class_exists('SH_Contact_Form')) {
register_widget('SH_Contact_Form');
}
register_sidebar(array('name' => esc_html__('Default Sidebar', SH_NAME), 'id' => 'default-sidebar', 'description' => esc_html__('Widgets in this area will be shown on the right-hand side.', SH_NAME), 'class' => '', 'before_widget' => '<div id="%1$s" class="widget clearfix %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="widget-title clearfix"><h3>', 'after_title' => '</h3></div>'));
register_sidebar(array('name' => esc_html__('Footer Sidebar', SH_NAME), 'id' => 'footer-sidebar', 'description' => esc_html__('Widgets in this area will be shown on the footer.', SH_NAME), 'class' => '', 'before_widget' => '<div id="%1$s" class="clearfix %2$s">', 'after_widget' => '</div>', 'before_title' => '<h4>', 'after_title' => '</h4>'));
if (!is_object(_WSH())) {
return;
}
$sidebars = sh_set(sh_set($theme_options, 'dynamic_sidebar'), 'dynamic_sidebar');
foreach (array_filter((array) $sidebars) as $sidebar) {
if (sh_set($sidebar, 'topcopy')) {
continue;
}
$name = sh_set($sidebar, 'sidebar_name');
if (!$name) {
continue;
}
$slug = sh_slug($name);
register_sidebar(array('name' => $name, 'id' => $slug, 'before_widget' => '<div class="widget">', 'after_widget' => "</div>", 'before_title' => '<div class="widget-title"><h3><span class="divider"></span>', 'after_title' => '</h3></div>'));
}
update_option('wp_registered_sidebars', $wp_registered_sidebars);
}
示例2: sh_admin_custom_scripts
function sh_admin_custom_scripts()
{
global $pagenow;
if ($pagenow == 'themes.php' && sh_set($_GET, 'page') == SH_NAME . '_option' || sh_set($_REQUEST, 'action') == 'vp_ajax_wp_genuine_theme_options_save') {
wp_enqueue_script('vp-metabox', get_template_directory_uri() . '/includes/vafpress/public/js/metabox.min.js', '', '', true);
}
}
示例3: launch
function launch()
{
$theme_options = _WSH()->option();
$theme_options_url = admin_url('themes.php?page=' . SH_NAME . '_option');
$this->purchase_code = sh_set($theme_options, 'sh_purchase_code');
$this->purchase_user = sh_set($theme_options, 'sh_purchase_user');
if (function_exists('wp_get_theme')) {
$this->theme_data = wp_get_theme(get_option('template'));
$this->theme_version = $this->theme_data->Version;
} else {
$this->theme_data = get_theme_data(get_template_directory() . '/style.css');
$this->theme_version = $this->theme_data['Version'];
}
$this->theme_base = get_option('template');
if (!$this->purchase_code && !$this->purchase_user) {
$this->errors[] = sprintf(__('<strong>%s Theme Notice:</strong> Please enter a valid <a href="%s">purchase code and themeforest username</a> to get automatic theme update', SH_NAME), $this->theme_data['Name'], $theme_options_url);
}
add_action('admin_notices', array($this, '_admin_notice'));
if ($this->errors) {
return;
}
/**************************************************/
//Uncomment below to find the theme slug that will need to be setup on the api server
//var_dump($theme_base);
add_filter('pre_set_site_transient_update_themes', array($this, 'check_for_update'));
// Take over the Theme info screen on WP multisite
add_filter('themes_api', array($this, 'my_theme_api_call'), 10, 3);
if (is_admin()) {
$this->current = get_transient('update_themes');
}
}
示例4: vc_theme_vc_row
function vc_theme_vc_row($atts, $content = null)
{
extract(shortcode_atts(array('el_class' => '', 'el_id' => '', 'bg_image' => '', 'bg_color' => '', 'bg_image_repeat' => '', 'font_color' => '', 'padding' => '', 'margin_bottom' => '', 'container' => '', 'css' => ''), $atts));
$atts['base'] = '';
wp_enqueue_style('js_composer_front');
wp_enqueue_script('wpb_composer_front_js');
wp_enqueue_style('js_composer_custom_css');
$vc_row = new WPBakeryShortCode_VC_Row($atts);
$el_class = $vc_row->getExtraClass($el_class);
$output = '';
$css_class = $el_class;
$id = sh_set($atts, 'el_id') ? ' id="' . $atts['el_id'] . '"' : '';
if ($css) {
$css_class .= vc_shortcode_custom_css_class($css, ' ') . ' ';
}
$style = $vc_row->buildStyle($bg_image, $bg_color, $bg_image_repeat, $font_color, $padding, $margin_bottom);
//$boxed = sh_set( _WSH()->option(), 'boxed_layout' );
//if( $css_class) exit($css_class);
if ($container) {
return '<section class="section ' . $css_class . '" ' . $style . $id . ' >
<div class="container">
<div class="general-row">
' . wpb_js_remove_wpautop($content) . '
</div>
</div>
<div class="clearfix"></div>
</section>
' . "\n";
}
return '<section class="section ' . $css_class . ' general-row" ' . $style . $id . ' >
' . wpb_js_remove_wpautop($content) . '
<div class="clearfix"></div>
</section>
' . "\n";
}
示例5: updateNavMenuItem
function updateNavMenuItem($menu_id, $menu_item_db_id, $args)
{
$isTopLevel = $args['menu-item-parent-id'] == 0 ? true : false;
$sidebar = '';
if (!$isTopLevel) {
$parent_id = $args['menu-item-parent-id'];
$parent_status = get_post_meta($parent_id, '_menu_item_status', true);
update_post_meta($menu_item_db_id, '_menu_item_status', $parent_status);
} else {
$status = 'inactive';
if (isset($_POST['megamenu_status'][$menu_item_db_id]) && $_POST['megamenu_status'][$menu_item_db_id] == 'active') {
$status = 'active';
}
update_post_meta($menu_item_db_id, '_menu_item_status', $status);
}
//printr($_POST);
if ($isTopLevel) {
/** Store other fields*/
update_post_meta($menu_item_db_id, '_sh_menu_columns', sh_set(sh_set($_POST, '_sh_menu_columns'), $menu_item_db_id, 2));
}
if (isset($_POST['_sh_menu_sidebar'][$menu_item_db_id]) && !empty($_POST['_sh_menu_sidebar'][$menu_item_db_id])) {
$sidebar = $_POST['_sh_menu_sidebar'][$menu_item_db_id];
}
update_post_meta($menu_item_db_id, '_sh_menu_sidebar', $sidebar);
update_post_meta($menu_item_db_id, '_sh_menu_item_submenu_type', sh_set(sh_set($_POST, 'menu_item_submenu_type'), $menu_item_db_id, 'default_dropdown'));
}
示例6: get_term_meta
function get_term_meta($id = '', $key = '')
{
global $post, $post_type;
$id = $id ? $id : sh_set($post, 'ID');
$key = $key ? $key : '_sh_' . $post_type . '_settings';
$meta = get_post_meta($id, $key, true);
return $meta ? $meta : false;
}
示例7: maintainance
function maintainance()
{
$options = _WSH()->option();
if (sh_set($options, 'maintainance_status')) {
$m_page = sh_set($options, 'maintainance_page');
if ($m_page && !is_user_logged_in() && !is_page($m_page)) {
wp_redirect(get_permalink($m_page));
}
}
}
示例8: bistro_slider
function bistro_slider()
{
$settings = (include get_template_directory() . '/includes/resource/post_types.php');
foreach ($options as $k => $v) {
$labels = $this->labels(sh_set($v, 'labels'), sh_set($v, 'label_args'));
$rewrite = array('slug' => sh_set($v, 'slug'), 'with_front' => true, 'pages' => true, 'feeds' => false);
$args = $this->args(array('labels' => $labels, 'supports' => sh_set($v, 'supports'), 'rewrite' => $rewrite));
$args = wp_parse_args(sh_set($v, 'args'), $args);
register_post_type($k, $args);
}
}
示例9: withArray
public static function withArray($arr = array(), $class_name = null)
{
if (is_null($class_name)) {
$instance = new self();
} else {
$instance = new $class_name();
}
$instance->_basic_make($arr);
$instance->_fields = sh_set($arr, 'fields');
$instance->_alchemy = new VP_MetaBox_Alchemy1(array('id' => $instance->get_name(), 'template' => array(array('type' => 'group', 'repeating' => true, 'name' => $instance->get_name(), 'title' => $instance->get_label(), 'fields' => $instance->_fields))));
return $instance;
}
示例10: create_atts
function create_atts($array = array())
{
//$contents = '';
$atts = array();
foreach ($array['params'] as $arr) {
if ($arr['param_name'] == 'content') {
continue;
}
$atts[$arr['param_name']] = sh_set($arr, 'default') ? sh_set($arr, 'default') : '';
}
return $atts;
}
示例11: __construct
function __construct()
{
// Hook into the 'init' action
//add_action( 'init', array($this, 'taxonomies'), 0 );
$theme_option = _WSH()->option();
$this->team_cat_slug = sh_set($theme_option, 'team_category_permalink', 'team_category');
$this->services_cat_slug = sh_set($theme_option, 'services_category_permalink', 'services_category');
$this->projects_cat_slug = sh_set($theme_option, 'projects_category_permalink', 'projects_category');
$this->gallery_cat_slug = sh_set($theme_option, 'gallery_category_permalink', 'gallery_category');
$this->testimonials_cat_slug = sh_set($theme_option, 'testimonial_category_permalink', 'testimonials_category');
$this->faq_cat_slug = sh_set($theme_option, 'faq_category_permalink', 'faq_category');
$this->taxonomies();
}
示例12: __construct
function __construct()
{
// Hook into the 'init' action
add_action('init', array($this, 'taxonomies'), 0);
$theme_option = _WSH()->option();
$this->team_cat_slug = sh_set($theme_option, 'team_category_permalink', 'team_category');
$this->projects_cat_slug = sh_set($theme_option, 'projects_category_permalink', 'projects_category');
$this->causes_cat_slug = sh_set($theme_option, 'causes_category_permalink', 'causes_category');
$this->events_cat_slug = sh_set($theme_option, 'events_category_permalink', 'events_category');
$this->gallery_cat_slug = sh_set($theme_option, 'gallery_category_permalink', 'gallery_category');
$this->testimonials_cat_slug = sh_set($theme_option, 'testimonials_category_permalink', 'testimonials_category');
$this->donars_cat_slug = sh_set($theme_option, 'donars_category_permalink', 'donars_category');
}
示例13: wp_footer
function wp_footer()
{
$analytics = sh_set(_WSH()->option(), 'footer_analytics');
if ($analytics) {
?>
<script type="text/javascript">
<?php
echo $analytics;
?>
</script>
<?php
}
}
示例14: wp_footer
function wp_footer()
{
$theme_options = _WSH()->option();
if (sh_set($theme_options, 'footer_analytics')) {
?>
<script type="text/javascript">
<?php
echo sh_set($theme_options, 'footer_analytics');
?>
</script>
<?php
}
}
示例15: publish_post
function publish_post($post_id)
{
global $post;
$post_type = sh_set($_POST, 'post_type');
$setting = sh_set($this->_fields, $post_type);
$types = array_merge(array('post', 'page'), array_keys($this->_fields));
if (!in_array($post_type, $types)) {
return;
}
$data = sh_set($_POST, $post_type);
//array_intersect_key( $_POST, $setting);
if (!$data) {
return;
}
//printr($post);
if ($post_type == 'bistro_deal') {
update_post_meta($post_id, '_bistro_bistro_deal_date', strtotime(sh_set($data, 'end_date')));
}
update_post_meta($post_id, '_bistro_' . $post_type . '_settings', $data);
}