本文整理汇总了PHP中cherry_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP cherry_get_option函数的具体用法?PHP cherry_get_option怎么用?PHP cherry_get_option使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cherry_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_option
/**
* Get shop option by name
*
* @since 1.0.0
* @uses cherry_get_option()
* @param string $option option name.
* @param mixed $default default option value.
* @return mixed
*/
public function get_option($option, $default = false)
{
if (!function_exists('cherry_get_option')) {
return $default;
}
return cherry_get_option($option, $default);
}
示例2: cherry_mega_menu_get_option
/**
* Get option by name from theme options
*
* @since 1.0.0
*
* @uses cherry_get_option use cherry_get_option from Cherry framework if exist
*
* @param string $name option name to get
* @param mixed $default default option value
* @return mixed option value
*/
function cherry_mega_menu_get_option($name, $default = false)
{
if (function_exists('cherry_get_option')) {
$result = cherry_get_option($name, $default);
return $result;
}
return $default;
}
示例3: callback
/**
* Callback-method for registered static.
*
* @since 4.0.0
*/
public function callback()
{
$alias = cherry_get_option('moto-slider-alias');
if (!$alias) {
return;
}
motoPressSlider($alias);
}
示例4: get_option
/**
* Get option by name from theme options
*
* @since 1.0.0
*
* @uses cherry_get_option use cherry_get_option from Cherry framework if exist
*
* @param string $name option name to get.
* @param mixed $default default option value.
* @return mixed
*/
public static function get_option($name, $default = false)
{
if (function_exists('cherry_get_option')) {
$result = cherry_get_option($name, $default);
return $result;
}
return $default;
}
示例5: get_css_varaibles
/**
* Get CSS variables into array
*
* @since 4.0.0
*
* @return array dynamic CSS variables
*/
public function get_css_varaibles()
{
$var_list = array('color-link', 'color-link-hover', 'color-primary', 'color-secondary', 'color-success', 'color-info', 'color-warning', 'color-danger', 'color-gray-variations', 'typography-body', 'typography-header-logo', 'typography-footer-logo', 'typography-header-menu', 'typography-footer-menu', 'typography-h1', 'typography-h2', 'typography-h3', 'typography-h4', 'typography-h5', 'typography-h6', 'typography-input-text', 'typography-breadcrumbs', 'typography-footer', 'body-background', 'header-background', 'content-background', 'footer-background', 'grid-container-width', 'header-boxed-width', 'content-boxed-width', 'footer-boxed-width', 'header-grid-type', 'content-grid-type', 'footer-grid-type', 'grid-responsive');
$var_list = apply_filters('cherry_css_var_list', $var_list);
if (!is_array($var_list)) {
return array();
}
$result = array();
foreach ($var_list as $var) {
$result[$var] = cherry_get_option($var);
}
return $result;
}
示例6: callback
/**
* Callback-method for registered static.
* @since 4.0.0
*/
public function callback()
{
$footer_text = cherry_get_option('footer-text');
if (!empty($footer_text)) {
$footer_text = preg_replace_callback('/%%([a-zA-Z0-9-_]+)%%/', array($this, 'texturize_links'), $footer_text);
printf('<div class="site-info">%s</div>', $footer_text);
return;
}
$format = apply_filters('cherry_default_footer_info_format', '%2$s © %1$s. %3$s');
$output = '<div class="site-info">';
$output .= sprintf($format, date_i18n('Y'), cherry_get_site_link('footer-site-link'), cherry_get_link_by_slug('privacy-policy'));
$output .= '</div>';
echo $output;
}
示例7: cherry_get_styles
/**
* Returns an array of the core framework's available styles for use in themes.
*
* @since 4.0.0
* @return array $styles All the available framework styles.
*/
function cherry_get_styles()
{
// Get the theme prefix.
$prefix = cherry_get_prefix();
// Get the active theme stylesheet version.
$version = wp_get_theme()->get('Version');
// Prepare set of stylesheets.
$styles = array();
// Get the theme-supported stylesheets.
$supports = get_theme_support('cherry-styles');
// If the theme support for any styles.
if (!empty($supports[0]) && is_array($supports[0])) {
$drop_downs = array('handle' => get_template() . '-drop-downs', 'src' => trailingslashit(CHERRY_URI) . 'assets/css/drop-downs.css', 'version' => '1.0.0');
// Is responsive site?
$responsive = cherry_get_option('grid-responsive');
$grid_responsive = 'true' == $responsive ? array('handle' => $prefix . 'grid-responsive', 'src' => cherry_file_uri('assets/css/grid-responsive.css'), 'version' => $version) : false;
$main_responsive = 'true' == $responsive ? array('handle' => $prefix . 'main-responsive', 'src' => cherry_file_uri('assets/css/main-responsive.css'), 'version' => $version) : false;
// Default styles.
$defaults = apply_filters('cherry_get_styles_defaults', array('grid-base' => array('handle' => $prefix . 'grid-base', 'src' => cherry_file_uri('assets/css/grid-base.css'), 'version' => $version), 'grid-responsive' => $grid_responsive, 'drop-downs' => $drop_downs, 'magnific-popup' => array('handle' => 'magnific-popup', 'src' => trailingslashit(CHERRY_URI) . 'assets/css/magnific-popup.css', 'version' => '1.0.0'), 'slick' => array('handle' => 'slick', 'src' => trailingslashit(CHERRY_URI) . 'assets/css/slick.css', 'version' => '1.5.0'), 'main' => array('handle' => $prefix . 'main', 'src' => cherry_file_uri('assets/css/main.css'), 'version' => $version), 'main-responsive' => $main_responsive, 'add-ons' => array('handle' => get_template() . '-add-ons', 'src' => trailingslashit(CHERRY_URI) . 'assets/css/add-ons.css', 'version' => CHERRY_VERSION)));
foreach ($supports[0] as $s) {
if (empty($defaults[$s])) {
continue;
}
if (!is_array($defaults[$s])) {
continue;
}
$styles[$s] = $defaults[$s];
}
}
// Add the main stylesheet (this must be included).
$styles['style'] = array('handle' => $prefix . 'style', 'src' => get_stylesheet_uri(), 'version' => $version);
/**
* Filters the array of styles.
*
* @since 4.0.0
* @param array $styles
*/
return apply_filters('cherry_get_styles', $styles);
}
示例8: cherry_content_wrap
/**
* Output Primary Content Wrap.
*
* @since 4.0.0
*/
function cherry_content_wrap()
{
if (!did_action('cherry_content')) {
$wrapper = '';
if (false !== cherry_display_sidebar(apply_filters('cherry_get_main_sidebar', 'sidebar-main'))) {
$object_id = apply_filters('cherry_current_object_id', get_queried_object_id());
$layout = apply_filters('cherry_get_page_layout', get_post_meta($object_id, 'cherry_layout', true));
if (empty($layout) || 'default-layout' == $layout) {
if (is_single()) {
$layout = apply_filters('cherry_get_single_post_layout', cherry_get_option('single-post-layout'), $object_id);
} else {
$layout = cherry_get_option('page-layout');
}
}
$class = sanitize_html_class($layout . '-wrapper');
$wrapper_class = apply_filters('cherry_content_sidebar_wrapper_class', $class);
$wrapper = sprintf('<div class="%s">', $wrapper_class);
}
printf('%1$s<div id="primary" class="content-area"><main %2$s>', $wrapper, cherry_get_attr('main'));
} else {
echo '</main></div>';
}
}
示例9: _cherry_post_media_visibility
function _cherry_post_media_visibility($display, $args)
{
if (is_single(get_the_ID()) && 'false' == cherry_get_option('blog-post-featured-image')) {
return '';
}
if (!is_single() && 'false' == cherry_get_option('blog-featured-images')) {
return '';
}
return $display;
}
示例10: prepare_dynamic_css
/**
* Compile dynamic CSS
*
* @since 4.0.0
*/
function prepare_dynamic_css()
{
ob_start();
$parent_css = PARENT_DIR . '/init/css/dynamic-style.css';
$child_css = CHILD_DIR . '/init/css/dynamic-style.css';
// Include framework dynamic CSS file
if (file_exists($parent_css)) {
include $parent_css;
}
// Include child theme Dynamic CSS file (if fwe use child theme, not framework)
if (file_exists($child_css) && $parent_css !== $child_css) {
include $child_css;
}
/**
* Allow 3rd party plugins and child themes pass own CSS to parser
*
* @since 4.0.0
*/
do_action('cherry_dynamic_styles');
$data = ob_get_clean();
$user_css = cherry_get_option('general-user-css');
if ($user_css) {
$data .= $user_css;
}
require_once CHERRY_CLASSES . '/class-cherry-css-parser.php';
$css_parser = new cherry_css_parser();
$data = $css_parser->parse($data);
return $data;
}
示例11: dynamic_styles
/**
* Add to dynamic css
*
* @since 1.0.0
*/
public function dynamic_styles()
{
$preset_user_css = cherry_get_option('preset-user-css');
echo $preset_user_css;
}
示例12: callback
/**
* Callback-method for registered static.
*
* @since 4.0.0
*/
public function callback()
{
echo do_shortcode(cherry_get_option('google_map_block'));
}
示例13: add_font
/**
* Get single typography option value from database and store it in object property
*
* @since 4.0.0
*
* @param string $option option name to get from database
*/
function add_font($option)
{
$option_val = cherry_get_option($option, false);
if (!$option_val || !is_array($option_val)) {
return;
}
if (array_key_exists('family', $option_val)) {
$this->push_font($option_val);
} else {
foreach ($option_val as $font_data) {
$this->push_font($font_data);
}
}
}
示例14: cherry_get_comments_template
/**
* Loads template for comments.
*
* @since 4.0.0
*/
function cherry_get_comments_template()
{
$post_type = get_post_type();
if (!post_type_supports($post_type, 'comments')) {
return;
}
if (!is_singular($post_type)) {
return;
}
if ('post' == $post_type && 'false' == cherry_get_option('blog-comment-status')) {
return;
}
if ('page' == $post_type && 'false' == cherry_get_option('page-comments-status')) {
return;
}
// If comments are open or we have at least one comment, load up the comment template.
if (comments_open() || get_comments_number()) {
// Loads the comments.php template.
comments_template('/templates/comments.php', true);
}
}
示例15: cherry_prepare_sticky_vars
/**
* Prepare JS variables for sticky header script
*
* @since 4.0.0
*/
function cherry_prepare_sticky_vars()
{
$is_sticky = cherry_get_option('header-sticky', 'false');
$defaults = array('correctionSelector' => '#wpadminbar', 'listenSelector' => '.listenSelector', 'pseudo' => true);
$options_args = array('active' => 'true' == $is_sticky && !wp_is_mobile() ? true : false);
$args = apply_filters('cherry_header_sticky_args', $defaults);
$sticky_selector = cherry_get_option('header-sticky-selector', '.site-header');
$args = array_merge($args, $options_args);
$data = array('selector' => $sticky_selector, 'args' => $args);
wp_localize_script('cherry-script', 'sticky_data', $data);
}