本文整理汇总了PHP中wpgrade::option方法的典型用法代码示例。如果您正苦于以下问题:PHP wpgrade::option方法的具体用法?PHP wpgrade::option怎么用?PHP wpgrade::option使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpgrade
的用法示例。
在下文中一共展示了wpgrade::option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_content
public function render_content()
{
$field = search_multi($this->ReduxFramework->sections, 'id', $this->option_key);
// the key is always unique so there will be only one
$field = $field[0];
if (!isset($field['name_suffix'])) {
$field['name_suffix'] = "";
}
if (!isset($field['default'])) {
$field['default'] = array();
}
$field['custom_data'] = $this->get_link();
$field_class = 'ReduxFramework_customizer_checkbox';
if (!class_exists($field_class)) {
$class_file = apply_filters('redux-typeclass-load', '/inc/fields/checkbox/field_checkbox.php', $field_class);
if ($class_file === 'inc/fields/checkbox/field_checkbox.php') {
/* for PRO users! - * @noinspection PhpIncludeInspection */
require_once wpgrade::corepath() . 'vendor/redux3/' . $class_file;
}
}
$value = wpgrade::option($field['id'], 0);
if (class_exists($field_class) && method_exists($field_class, 'render')) {
$enqueue = new $field_class($field, $value, $this->ReduxFramework);
// $enqueue->enqueue();
echo "<label>" . "<span class=\"customize-control-title\">" . $field['title'] . "</span>" . "</label>";
echo '<div class="redux-container-' . $this->type . '">';
echo $enqueue->render();
echo '<div>';
}
}
示例2: render_content
/**
* A custom render for sliders in customizer panel
*/
public function render_content()
{
$field = search_multi($this->ReduxFramework->sections, 'id', $this->option_key);
// the key is always unique so there will be only one
$field = $field[0];
if (!isset($field['name_suffix'])) {
$field['name_suffix'] = "";
}
if (!isset($field['default'])) {
$field['default'] = array();
}
$field['custom_data'] = $this->get_link();
$field_class = 'ReduxFramework_customizer_background';
if (!class_exists($field_class)) {
$class_file = apply_filters('redux-typeclass-load', '/inc/fields/background/field_background.php', $field_class);
if ($class_file === '/inc/fields/background/field_background.php') {
/** @noinspection PhpIncludeInspection */
require_once wpgrade::corepath() . 'vendor/redux3/' . $class_file;
}
}
$value = wpgrade::option($field['id'], $field['default']);
// get wordpress default labels
$this->json['button_labels'] = array('select' => __('Select Image'), 'change' => __('Change Image'), 'remove' => __('Remove'), 'default' => __('Default'), 'placeholder' => __('No image selected'), 'frame_title' => __('Select Image'), 'frame_button' => __('Choose Image'));
if (class_exists($field_class) && method_exists($field_class, 'render')) {
$field_object = new $field_class($field, $value, $this->ReduxFramework);
// $enqueue->enqueue();
echo "<label>" . "<span class=\"customize-control-title\">" . $field['title'] . "</span>" . "</label>";
// echo '<div class="redux-container-'. $this->type . '" >';
echo $field_object->render();
// echo '<div>';
}
}
示例3: wpgrade_callback_enqueue_dynamic_css
function wpgrade_callback_enqueue_dynamic_css()
{
$style_query = array();
// if (wpgrade::option('main_color')) {
// $main_color = wpgrade::option('main_color');
// $main_color = str_replace('#', '', $main_color);
// $style_query['color'] = $main_color;
// }
if (wpgrade::option('use_google_fonts')) {
add_action('wp_head', 'wpgrade_callback_load_google_fonts');
$fonts_array = array('google_titles_font', 'google_second_font', 'google_nav_font', 'google_body_font');
foreach ($fonts_array as $font) {
$the_font = wpgrade::get_the_typo($font);
// var_dump($the_font);
if (!empty($the_font)) {
$style_query['fonts'][$font] = $the_font;
}
}
}
// if (wpgrade::option('portfolio_text_color')) {
// $port_color = wpgrade::option('portfolio_text_color');
// $port_color = str_replace('#', '', $port_color);
// $style_query['port_color'] = $port_color;
// }
if (wpgrade::option('inject_custom_css') == 'file') {
wp_enqueue_style('wpgrade-custom-style', get_template_directory_uri() . '/theme-content/css/custom.css');
}
}
示例4: wpgrade_clean_static_files
function wpgrade_clean_static_files()
{
if (wpgrade::option('remove_parameters_from_static_res')) {
add_filter('the_generator', 'wpgrade_remove_version_info');
add_filter('script_loader_src', 'wpgrade_remove_script_version', 15, 1);
add_filter('style_loader_src', 'wpgrade_remove_script_version', 15, 1);
}
}
示例5: wpgrade_callback_load_woocommerce_assets
function wpgrade_callback_load_woocommerce_assets()
{
global $woocommerce;
if (!wpgrade::option('enable_woocommerce_support', '0')) {
return;
}
wp_enqueue_style('wpgrade-woocommerce', get_template_directory_uri() . '/assets/css/woocommerce.css', array('woocommerce-general'), wpgrade::cachebust_string(wpgrade::themefilepath('assets/css/woocommerce.css')));
}
示例6: wpgrade_callback_themesetup
/**
* ...
*/
function wpgrade_callback_themesetup()
{
// General Purpose Resource Handling
// ---------------------------------
// register resources
add_action('wp_enqueue_scripts', 'wpgrade_callback_register_theme_resources', 1);
// auto-enque based on configuration entries and callbacks
add_action('wp_enqueue_scripts', 'wpgrade_callback_enqueue_theme_resources', 1);
$themeconfiguration = wpgrade::config();
// Specialized Resource Handling
// -----------------------------
// extra script equeue handlers
foreach ($themeconfiguration['resources']['script-enqueue-handlers'] as $callback) {
if ($callback !== null) {
if (!is_array($callback)) {
add_action('wp_enqueue_scripts', $callback, 10);
} else {
// $callback is array
if (!empty($callback['handler'])) {
isset($callback['priority']) or $callback['priority'] = 10;
add_action('wp_enqueue_scripts', $callback['handler'], $callback['priority']);
}
}
}
}
// extra style equeue handlers
foreach ($themeconfiguration['resources']['style-enqueue-handlers'] as $callback) {
if ($callback !== null) {
if (!is_array($callback)) {
add_action('wp_enqueue_scripts', $callback, 10);
} else {
// $callback is array
if (!empty($callback['handler'])) {
isset($callback['priority']) or $callback['priority'] = 10;
add_action('wp_enqueue_scripts', $callback['handler'], $callback['priority']);
}
}
}
}
// some info
add_action('after_switch_theme', 'wpgrade_callback_gtkywb');
// custom javascript handlers - make sure it is the last one added
add_action('wp_head', 'wpgrade_callback_load_custom_js', 999);
add_action('wp_footer', 'wpgrade_callback_load_custom_js_footer', 999);
if (wpgrade::option('inject_custom_css') == 'inline') {
$handler = wpgrade::confoption('custom-css-handler', null);
if (empty($handler)) {
$handler = 'wpgrade_callback_inlined_custom_style';
}
add_action('wp_enqueue_scripts', $handler, 999999);
}
}
示例7: wpgrade_callback_load_custom_js_footer
function wpgrade_callback_load_custom_js_footer()
{
$custom_js = wpgrade::option('custom_js_footer');
if (!empty($custom_js)) {
//first lets test is the js code is clean or has <script> tags and such
//if we have <script> tags than we will not enclose it in anything - raw output
if (strpos($custom_js, '</script>') !== false) {
echo $custom_js . "\n";
} else {
echo "<script type=\"text/javascript\">\n;(function(\$){\n" . $custom_js . "\n})(jQuery);\n</script>\n";
}
}
}
示例8: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$social_links = wpgrade::option('social_icons');
$target = '';
if (wpgrade::option('social_icons_target_blank')) {
$target = 'target="_blank"';
}
// Reset Post Data
wp_reset_postdata();
echo $before_widget;
if (!empty($social_links)) {
?>
<?php
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<div class="btn-list">
<?php
foreach ($social_links as $domain => $icon) {
if (isset($icon['value']) && isset($icon['checkboxes']['widget'])) {
$value = $icon['value'];
?>
<a href="<?php
echo $value;
?>
" <?php
echo $target;
?>
>
<i class="pixcode pixcode--icon icon-e-<?php
echo $domain;
?>
"></i>
</a>
<?php
}
}
?>
</div>
<?php
}
echo $after_widget;
}
示例9: wpgrade_write_custom_css
function wpgrade_write_custom_css($options)
{
if (wpgrade::option('inject_custom_css') !== 'file') {
return;
}
$error = false;
global $wp_filesystem;
// Initialise the Wordpress filesystem, no more using file_put_contents function
if (empty($wp_filesystem)) {
require_once ABSPATH . '/wp-admin/includes/file.php';
WP_Filesystem();
}
$css_dir = get_template_directory() . '/assets/css/';
ob_start();
include wpgrade::corepartial('inline-custom-css' . EXT);
$css = ob_get_clean();
$wp_filesystem->put_contents($css_dir . 'custom.css', $css, FS_CHMOD_FILE);
if ($error == true) {
echo 'There is been an error around';
}
}
示例10: foreach
?>
"
data-customArrows
<?php
if ($slider_transition == 'move') {
echo 'data-slidertransitiondirection="horizontal"' . PHP_EOL;
}
if ($slider_autoplay) {
echo 'data-sliderautoplay="" ' . PHP_EOL;
echo 'data-sliderdelay="' . $slider_delay . '" ' . PHP_EOL;
}
if ($slider_visiblenearby) {
echo 'data-visiblenearby ' . PHP_EOL;
}
if (wpgrade::option('slideshow_arrows_style') == 'hover') {
echo ' data-hoverarrows ';
}
?>
>
<?php
$set_cover = false;
foreach ($attachments as $attachment) {
$full_img = wp_get_attachment_image_src($attachment->ID, 'full-size');
$attachment_fields = get_post_custom($attachment->ID);
// prepare the video url if there is one
$video_url = isset($attachment_fields['_video_url'][0]) && !empty($attachment_fields['_video_url'][0]) ? esc_url($attachment_fields['_video_url'][0]) : '';
// should the video auto play?
$video_autoplay = isset($attachment_fields['_video_autoplay'][0]) && !empty($attachment_fields['_video_autoplay'][0]) && $attachment_fields['_video_autoplay'][0] === 'on' ? $attachment_fields['_video_autoplay'][0] : '';
if (true === $set_cover) {
?>
示例11: explode
<?php
/* for PRO users! -
* Get the comma delimited string from Theme Options and generate the a tags that are needed to make AddThis sharing work
*/
$share_buttons_types = wpgrade::option('share_buttons_settings');
if (!empty($share_buttons_types) || $share_buttons_types !== 'false') {
//lets go through each button type and create the needed markup
//but first some cleaning - remove all whitespaces
$share_buttons_types = preg_replace('/\\s+/', '', $share_buttons_types);
//now take each setting
$buttons = explode(',', $share_buttons_types);
//the preferred buttons need to have numbering appended to them
$preferred_count = 0;
$display_share_buttons = '';
if (!empty($buttons)) {
for ($k = 0; $k < count($buttons); $k++) {
switch ($buttons[$k]) {
case 'preferred':
$preferred_count++;
$display_share_buttons .= '<a class="addthis_button_' . $buttons[$k] . '_' . $preferred_count . '"></a>';
break;
case 'more':
$display_share_buttons .= '<a class="addthis_button_compact"></a>';
break;
case 'counter':
$display_share_buttons .= '<a class="addthis_counter addthis_bubble_style"></a>';
break;
default:
$display_share_buttons .= '<a class="addthis_button_' . $buttons[$k] . '"></a>';
}
示例12: get_bloginfo
?>
<img class="site-logo-img--light" src="<?php
echo wpgrade::image_src('main_logo_light');
?>
" <?php
echo $data_retina_logo_light;
?>
rel="logo" alt="<?php
echo get_bloginfo('name');
?>
"/>
<?php
if (wpgrade::image_src('main_logo_dark')) {
$retina_logo_dark = wpgrade::image_src('retina_main_logo_dark');
$data_retina_logo_dark = wpgrade::option('use_retina_logo') && !empty($retina_logo_dark) ? 'data-logo2x="' . $retina_logo_dark . '"' : '';
?>
<img class="site-logo-img--dark" src="<?php
echo wpgrade::image_src('main_logo_dark');
?>
" <?php
echo $data_retina_logo_dark;
?>
rel="logo" alt="<?php
echo get_bloginfo('name');
?>
"/>
<?php
}
?>
示例13: get_bloginfo
<?php
if (wpgrade::option('facebook_id_app')) {
?>
<meta property="fb:app_id" content="<?php
echo wpgrade::option('facebook_id_app');
?>
"/>
<?php
}
?>
<?php
if (wpgrade::option('facebook_admin_id')) {
?>
<meta property="fb:admins" content="<?php
echo wpgrade::option('facebook_admin_id');
?>
"/>
<?php
}
?>
<meta property="og:site_name" content="<?php
echo get_bloginfo("name");
?>
"/>
<meta property="og:url" content="<?php
echo $current_url;
?>
"/>
<meta property="og:title" content="<?php
wp_title('|', true, 'right');
示例14: load_social_share
function load_social_share()
{
if (wpgrade::option('prepare_for_social_share')) {
add_action('wp_head', 'wpgrade_callback_general_seo');
add_action('wp_head', 'wpgrade_callback_facebook_opengraph');
add_action('wp_head', 'wpgrade_callback_google_metas');
add_action('wp_head', 'wpgrade_callback_twitter_card');
}
}
示例15:
<svg class="blurp--bottom" width="192" height="61" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 160.7 61.5" enable-background="new 0 0 160.7 61.5" xml:space="preserve"><path fill="#FFFFFF" d="M80.3,61.5c0,0,22.1-2.7,43.1-5.4s41-5.4,36.6-5.4c-21.7,0-34.1-12.7-44.9-25.4S95.3,0,80.3,0c-15,0-24.1,12.7-34.9,25.4S22.3,50.8,0.6,50.8c-4.3,0-6.5,0,3.5,1.3S36.2,56.1,80.3,61.5z"/></svg>
<div class="btn--top">
<a href="#" class="btn--top_text">
<span class="btn__arrow btn__arrow--top"></span>
<span class="btn__arrow btn__arrow--bottom"></span>
</a>
</div>
<div class="container">
<div class="footer-container">
<?php
$copyright_text = wpgrade::option('copyright_text');
if (!empty($copyright_text)) {
?>
<div class="copyright-text">
<?php
echo wpgrade::option('copyright_text');
?>
</div>
<?php
}
wpgrade_footer_nav('<nav class="navigation navigation--footer">', '</nav>');
?>
</div>
</div>
</div>
<!-- .copyright-area -->
</footer><!-- .site--footer -->
<?php
}