当前位置: 首页>>代码示例>>PHP>>正文


PHP get_option函数代码示例

本文整理汇总了PHP中get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP get_option函数的具体用法?PHP get_option怎么用?PHP get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: base_getBreadcrumbs

function base_getBreadcrumbs()
{
    if (is_404()) {
        return false;
    }
    // Hack to fix breadcrumbs when you're viewing the news home
    if (is_home()) {
        $post = new \Timber\Post(get_option('page_for_posts'));
    } else {
        global $post;
    }
    $breadcrumbs = [];
    if ($post->post_parent) {
        $parent_id = $post->post_parent;
        while ($parent_id) {
            $page = get_page($parent_id);
            $breadcrumbs[] = new \Timber\Post($page->ID);
            $parent_id = $page->post_parent;
        }
        $breadcrumbs = array_reverse($breadcrumbs);
    }
    // Add 'Blog Home' to breadcrumbs if you're on a news post or archive
    if ((is_single() || is_archive()) && !is_search()) {
        $breadcrumbs[] = new \Timber\Post(get_option('page_for_posts'));
    }
    return $breadcrumbs;
}
开发者ID:wearebase,项目名称:web-wordpress,代码行数:27,代码来源:breadcrumbs.php

示例2: plugin_information

 /**
  * Sends and receives data to and from the server API
  *
  * @access public
  * @since  1.0.0
  * @return object $response
  */
 public function plugin_information($args)
 {
     $target_url = $this->create_upgrade_api_url($args);
     $apisslverify = get_option('mainwp_api_sslVerifyCertificate') === false || get_option('mainwp_api_sslVerifyCertificate') == 1 ? 1 : 0;
     $request = wp_remote_get($target_url, array('timeout' => 50, 'sslverify' => $apisslverify));
     //      $request = wp_remote_post( MainWP_Api_Manager::instance()->getUpgradeUrl() . 'wc-api/upgrade-api/', array('body' => $args) );
     if (is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) {
         return false;
     }
     $response = unserialize(wp_remote_retrieve_body($request));
     /**
      * For debugging errors from the API
      * For errors like: unserialize(): Error at offset 0 of 170 bytes
      * Comment out $response above first
      */
     // $response = wp_remote_retrieve_body( $request );
     // print_r($response); exit;
     if (is_object($response)) {
         if (isset($response->package)) {
             $response->package = apply_filters('mainwp_api_manager_upgrade_url', $response->package);
         }
         return $response;
     } else {
         return false;
     }
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:33,代码来源:class-mainwp-api-manager-plugin-update.php

示例3: ue_closeDefaultEditor

 /**
  * 当开启UEditor插件时,关闭默认的编辑器
  */
 function ue_closeDefaultEditor()
 {
     if (!get_option("close_default_editor")) {
         add_option("close_default_editor");
     }
     update_option("close_default_editor", "true");
 }
开发者ID:hjm8809,项目名称:xsphp.com,代码行数:10,代码来源:ueditor.class.php

示例4: render_content

    public function render_content()
    {
        ?>
		<label>
		<span class="customize-control-title"><?php 
        echo esc_html($this->label);
        ?>
</span>
		<p class="description customize-section-description"><?php 
        echo esc_html($this->description);
        ?>
</p>
		<select <?php 
        $this->link();
        ?>
 disabled="disabled">
		<?php 
        $var = get_option($this->field);
        foreach ($this->options as $option) {
            if ($this->options == $var) {
                echo '<option value="' . $option . '" selected="selected">' . $option . '</option>';
            } else {
                echo '<option value="' . $option . '">' . $option . '</option>';
            }
        }
        ?>
		</select>

		</label>
	<?php 
    }
开发者ID:Phoenix-redux,项目名称:koko,代码行数:31,代码来源:class-login-customizer-security-select-control.php

示例5: widget

 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
     $sticky = get_option('sticky_posts');
     $number = empty($instance['number']) ? 1 : (int) $instance['number'];
     $cat = empty($instance['category']) ? 0 : (int) $instance['category'];
     if (is_single()) {
         array_push($sticky, get_the_ID());
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     } else {
         echo '<br />';
     }
     $featuredPosts = new WP_Query(array('posts_per_page' => $number, 'cat' => $cat, 'post__not_in' => $sticky, 'no_found_rows' => true));
     while ($featuredPosts->have_posts()) {
         $featuredPosts->the_post();
         global $mb_content_area, $more;
         $mb_content_area = 'sidebar';
         get_template_part('content', get_post_format());
     }
     wp_reset_postdata();
     echo $after_widget;
 }
开发者ID:pavlinov,项目名称:1b.school59.eu,代码行数:26,代码来源:widget_feature.php

示例6: __construct

 public function __construct($data = array())
 {
     parent::__construct($data);
     if (!isset($data['name'])) {
         $this->name = 'eventlist';
     }
     if (!isset($data['posts'])) {
         $event_args = array();
         // Get the active plugins.
         $active_plugins = get_option('active_plugins');
         // We do some guessing here for Tzolkin
         if (in_array('tzolkin/tzolkin.php', $active_plugins)) {
             $event_args = ['post_type' => 'tz_events'];
         }
         // Some more guessing for The Events Calendar
         if (in_array('the-events-calendar/the-events-calendar.php', $active_plugins)) {
             $event_args = ['post_type' => \Tribe__Events__Main::POSTTYPE, 'orderby' => 'event_date', 'order' => 'ASC', 'posts_per_page' => tribe_get_option('postsPerPage', 10), 'tribe_render_context' => 'default'];
         }
         $eventlist_event_args_filter = $this->name . '_event_args';
         $event_args = apply_filters($eventlist_event_args_filter, $event_args);
         Atom::add_debug_entry('Filter', $eventlist_event_args_filter);
         $this->posts = new \WP_Query($event_args);
     }
     if (!isset($data['posts-structure'])) {
         $posts_structure = ['PostClass' => ['children' => ['image', 'text']], 'image' => ['parts' => ['PostThumbnail']], 'text' => ['parts' => ['EventBadge', 'PostTitleLink', 'EventDate', 'ForceExcerpt', 'PostLink' => 'Read More']]];
         $postlist_posts_structure_filter = $this->name . '_posts_structure';
         $this->posts_structure = apply_filters($postlist_posts_structure_filter, $posts_structure);
         Atom::add_debug_entry('Filter', $postlist_posts_structure_filter);
     }
 }
开发者ID:Clark-Nikdel-Powell,项目名称:Pattern-Library,代码行数:30,代码来源:event-list.php

示例7: __construct

 function __construct()
 {
     add_action('init', array(&$this, 'set_core_fields'), 1);
     add_action('init', array(&$this, 'set_predefined_fields'), 1);
     add_action('init', array(&$this, 'set_custom_fields'), 1);
     $this->saved_fields = get_option('um_fields');
 }
开发者ID:chrisuehlein,项目名称:couponsite,代码行数:7,代码来源:um-builtin.php

示例8: InitClass

 static function InitClass()
 {
     wp_enqueue_style(WPFB . '-admin', WPFB_PLUGIN_URI . 'css/admin.css', array(), WPFB_VERSION, 'all');
     wp_register_script('jquery-deserialize', WPFB_PLUGIN_URI . 'bower_components/jquery-deserialize/dist/jquery.deserialize.min.js', array('jquery'), WPFB_VERSION);
     if (isset($_GET['page'])) {
         $page = $_GET['page'];
         if ($page == 'wpfilebase_files') {
             wp_enqueue_script('postbox');
             wp_enqueue_style('dashboard');
         } elseif ($page == 'wpfilebase' && isset($_GET['action']) && $_GET['action'] == 'sync') {
             do_action('wpfilebase_sync');
             wp_die("Filebase synced.");
         }
     }
     add_action('wp_dashboard_setup', array(__CLASS__, 'AdminDashboardSetup'));
     //wp_register_widget_control(WPFB_PLUGIN_NAME, "[DEPRECATED]".WPFB_PLUGIN_NAME .' '. __('File list','wp-filebase'), array(__CLASS__, 'WidgetFileListControl'), array('description' => __('DEPRECATED','wp-filebase')));
     add_action('admin_print_scripts', array('WPFB_AdminLite', 'AdminPrintScripts'));
     self::CheckChangedVer();
     if (basename($_SERVER['PHP_SELF']) === "plugins.php") {
         if (isset($_GET['wpfb-uninstall']) && current_user_can('edit_files')) {
             update_option('wpfb_uninstall', !empty($_GET['wpfb-uninstall']) && $_GET['wpfb-uninstall'] != "0");
         }
         if (get_option('wpfb_uninstall')) {
             function wpfb_uninstall_warning()
             {
                 echo "\n\t\t\t\t<div id='wpfb-warning' class='updated fade'><p><strong>" . __('WP-Filebase will be uninstalled completely when deactivating the Plugin! All settings and File/Category Info will be deleted. Actual files in the upload directory will not be removed.', 'wp-filebase') . ' <a href="' . add_query_arg('wpfb-uninstall', '0') . '">' . __('Cancel') . "</a></strong></p></div>\n\t\t\t\t";
             }
             add_action('admin_notices', 'wpfb_uninstall_warning');
         }
     }
 }
开发者ID:noxian,项目名称:WP-Filebase,代码行数:31,代码来源:AdminLite.php

示例9: nktagcloud_init

/**
 * Things to run during init hook
 *
 * @since 0.8.6
 */
function nktagcloud_init()
{
    // http://codex.wordpress.org/Determining_Plugin_and_Content_Directories
    // Pre-2.6 compatibility
    if (!defined('WP_CONTENT_URL')) {
        define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
    }
    if (!defined('WP_CONTENT_DIR')) {
        define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
    }
    if (!defined('WP_PLUGIN_URL')) {
        define('WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins');
    }
    if (!defined('WP_PLUGIN_DIR')) {
        define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
    }
    global $nktagcloud;
    $nktagcloud = array('path' => WP_PLUGIN_DIR . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)), 'url' => WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)));
    // always needed for footer link
    // TODO which footer link? we don't need this in admin, or do we?
    require_once 'inc/page.php';
    if (is_admin()) {
        require_once 'inc/admin.php';
        add_action('admin_menu', 'nktagcloud_add_pages');
        register_widget_control(__('Better Tag Cloud', 'nktagcloud'), 'nktagcloud_control');
        register_sidebar_widget(__('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud');
    } else {
        add_shortcode('nktagcloud', 'nktagcloud_shortcode');
        add_shortcode('nktagcloud_single', 'nktagcloud_single_shortcode');
        register_sidebar_widget(__('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud');
    }
}
开发者ID:howardlei82,项目名称:IGSM-Website,代码行数:37,代码来源:nktagcloud.php

示例10: follow_pinterest

 function follow_pinterest($type, $id, $text = '', $icon = '')
 {
     $url = 'http://pinterest.com/' . $id . '/';
     $text = $text == '' ? __('Follow me on', 'mr_social_sharing_toolkit') . ' Pinterest' : $text;
     $blank = get_option('mr_social_sharing_follow_new') == 1 ? true : false;
     return $this->get_icon($type, $url, $text, $icon, false, $blank);
 }
开发者ID:EmmaTope,项目名称:Ekaruz-main,代码行数:7,代码来源:button.pinterest.php

示例11: run

 function run()
 {
     $this->settings = get_site_option('itsec_hide_backend');
     //Execute module functions on frontend init
     if ($this->settings['enabled'] === true) {
         $jetpack_active_modules = get_option('jetpack_active_modules');
         if (is_multisite() && function_exists('is_plugin_active_for_network')) {
             //see if Jetpack is active
             $is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array())) || is_plugin_active_for_network('jetpack/jetpack.php');
         } else {
             $is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array()));
         }
         if (!($is_jetpack_active === true && is_array($jetpack_active_modules) && in_array('json-api', $jetpack_active_modules) && isset($_GET['action']) && $_GET['action'] == 'jetpack_json_api_authorization')) {
             $this->auth_cookie_expired = false;
             add_action('auth_cookie_expired', array($this, 'auth_cookie_expired'));
             add_action('init', array($this, 'execute_hide_backend'), 1000);
             add_action('login_init', array($this, 'execute_hide_backend_login'));
             add_action('plugins_loaded', array($this, 'plugins_loaded'), 11);
             add_filter('body_class', array($this, 'remove_admin_bar'));
             add_filter('loginout', array($this, 'filter_loginout'));
             add_filter('wp_redirect', array($this, 'filter_login_url'), 10, 2);
             add_filter('lostpassword_url', array($this, 'filter_login_url'), 10, 2);
             add_filter('site_url', array($this, 'filter_login_url'), 10, 2);
             add_filter('retrieve_password_message', array($this, 'retrieve_password_message'));
             add_filter('comment_moderation_text', array($this, 'comment_moderation_text'));
             remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
         }
     }
 }
开发者ID:Garth619,项目名称:DMA-Franconnect-Local,代码行数:29,代码来源:class-itsec-hide-backend.php

示例12: load_plugin_settings

 function load_plugin_settings()
 {
     $this->context_options = get_option($this->options_name);
     if (!is_array($this->context_options) || empty($this->context_options)) {
         $this->context_options = array();
     }
 }
开发者ID:jaiweb,项目名称:ASP,代码行数:7,代码来源:widget-context.php

示例13: export

 /**
  * Export data
  * @param string $format
  * @param array $options
  * @throws Exception
  */
 public function export($format = self::EXPORT_DISPLAY, $options = array())
 {
     global $wpdb;
     $options = array();
     $options['upload_dir'] = wp_upload_dir();
     $options['options'] = array();
     $options['options']['permalink_structure'] = get_option('permalink_structure');
     $widgets = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE 'widget_%'");
     foreach ($widgets as $widget) {
         $options['options'][$widget->option_name] = $this->compress(get_option($widget->option_name));
     }
     $options['options']['sidebars_widgets'] = $this->compress(get_option('sidebars_widgets'));
     $current_template = get_option('stylesheet');
     $options['options']["theme_mods_{$current_template}"] = $this->compress(get_option("theme_mods_{$current_template}"));
     $data = serialize($options);
     if ($format == self::EXPORT_DISPLAY) {
         echo '<textarea>' . $data . '</textarea>';
     }
     //export settings to file
     if ($format == self::EXPORT_FILE) {
         $path = isset($options['path']) ? $options['path'] : self::getWpOptionsPath();
         if (!file_put_contents($path, $data)) {
             throw new Exception("Cannot save settings to: " . $path);
         }
     }
 }
开发者ID:clevervaughn,项目名称:dottiesbiscuitbarn,代码行数:32,代码来源:ctDemoExporterImporter.class.php

示例14: stachestack_title

/**
 * Page titles
 */
function stachestack_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            $title = get_the_title(get_option('page_for_posts', true));
        } else {
            $title = __('Latest Posts', 'stachestack');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            $title = apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            $title = apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            $title = sprintf(__('Daily Archives: %s', 'stachestack'), get_the_date());
        } elseif (is_month()) {
            $title = sprintf(__('Monthly Archives: %s', 'stachestack'), get_the_date('F Y'));
        } elseif (is_year()) {
            $title = sprintf(__('Yearly Archives: %s', 'stachestack'), get_the_date('Y'));
        } elseif (is_author()) {
            $title = sprintf(__('Author Archives: %s', 'stachestack'), get_queried_object()->display_name);
        } else {
            $title = single_cat_title('', false);
        }
    } elseif (is_search()) {
        $title = sprintf(__('Search Results for %s', 'stachestack'), get_search_query());
    } elseif (is_404()) {
        $title = __('Not Found', 'stachestack');
    } else {
        $title = get_the_title();
    }
    return apply_filters('stachestack_title', $title);
}
开发者ID:BeardandFedora,项目名称:StacheStack,代码行数:37,代码来源:titles.php

示例15: widget

 /**
  * Outputs the HTML for this widget.
  *
  * @param array  An array of standard parameters for widgets in this theme 
  * @param array  An array of settings for this widget instance 
  * @return void Echoes it's output
  **/
 public function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     $count = esc_attr($instance['count']);
     $count = 0 < $count && $count < 10 ? $count : 2;
     $loop = new WP_Query(array('post_type' => 'event', 'posts_per_page' => $count, 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => '_event_start', 'meta_query' => array(array('key' => '_event_end', 'value' => time(), 'compare' => '>'))));
     if ($loop->have_posts()) {
         echo $before_widget;
         if ($instance['title']) {
             echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
         }
         echo '<ul>';
         while ($loop->have_posts()) {
             $loop->the_post();
             global $post;
             $output = '<span class="meta">' . date(get_option('date_format'), get_post_meta(get_the_ID(), '_event_start', true)) . '</span> <a href="' . get_permalink() . '">' . get_the_title() . '</a>';
             $read_more = apply_filters('em4wp_events_manager_upcoming_widget_output', $output, $post);
             if ($read_more) {
                 echo '<li>' . $read_more . '</li>';
             }
         }
         if ($instance['more_text']) {
             echo '<li><a href="' . get_post_type_archive_link('event') . '">' . esc_attr($instance['more_text']) . '</a></li>';
         }
         echo '</ul>';
         echo $after_widget;
     }
     wp_reset_postdata();
 }
开发者ID:forsitemedia,项目名称:events-manager-for-wp,代码行数:36,代码来源:class-em4wp-upcoming-events.php


注:本文中的get_option函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。