本文整理汇总了PHP中wpgrade::confoption方法的典型用法代码示例。如果您正苦于以下问题:PHP wpgrade::confoption方法的具体用法?PHP wpgrade::confoption怎么用?PHP wpgrade::confoption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpgrade
的用法示例。
在下文中一共展示了wpgrade::confoption方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpgrade_register_custom_menus
function wpgrade_register_custom_menus()
{
add_theme_support('menus');
$menus = wpgrade::confoption('import_nav_menu');
foreach ($menus as $key => $value) {
register_nav_menu($key, $value);
}
}
示例2: 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);
}
}
示例3: wpgrade_custom_thumbnails
function wpgrade_custom_thumbnails()
{
// Add theme support for Featured Images
add_theme_support('post-thumbnails');
$sizes = wpgrade::confoption('thumbnails_sizes');
if (!empty($sizes)) {
foreach ($sizes as $size_key => $values) {
$width = 0;
if (isset($values['width'])) {
$width = $values['width'];
}
$height = 0;
if (isset($values['height'])) {
$height = $values['height'];
}
$hard_crop = false;
if (isset($values['hard_crop'])) {
$hard_crop = $values['hard_crop'];
}
add_image_size($size_key, $width, $height, $hard_crop);
}
}
}
示例4: array
<?php
// add theme support for post formats
$post_formats = wpgrade::confoption('post-formats', array());
if (!empty($post_formats)) {
add_theme_support('post-formats', $post_formats);
}
//add theme support for RSS feed links automatically generated in the head section
add_theme_support('automatic-feed-links');
//tell galleries and captions to behave nicely and use HTML5 markup
add_theme_support('html5', array('gallery', 'caption'));
/* for PRO users! - *
* http://codex.wordpress.org/Content_Width
*/
if (!isset($content_width)) {
$content_width = 960;
}
示例5: WPGradeOptions
// the handler is the main object responsible for managing the drivers
wpgrade::options_handler(new WPGradeOptions());
# [!!] driver priority works like a LIFO stack, last in = highest priority
// register basic configuration driver
$config = wpgrade::config();
wpgrade::options()->add_optiondriver(new WPGradeOptionDriver_Config($config['theme-options']));
// we register redux as option driver via a resolver
function wpgrade_callback_bootstrap_redux_instance($redux)
{
$reduxdriver = new WPGradeOptionDriver_Redux($redux);
wpgrade::options()->add_optiondriver($reduxdriver);
}
wpgrade::register_resolver('redux-instance', 'wpgrade_callback_bootstrap_redux_instance');
// Plugins & Resolvable Dependencies
// ---------------------------------
require wpgrade::themefilepath(wpgrade::confoption('theme-adminpanel-path', 'theme-content/admin-panel') . '/bootstrap' . EXT);
// Hooks
// -----
get_template_part('wpgrade-core/hooks');
// Upgrade Notifier
// ----------------
add_action('wp_ajax_wpgrade_upgradestep_check_marketplace_data', 'wpgrade_ajax_upgradestep_check_marketplace_data');
add_action('wp_ajax_wpgrade_upgradestep_search_for_update', 'wpgrade_ajax_upgradestep_search_for_update');
add_action('wp_ajax_wpgrade_upgradestep_backup_theme', 'wpgrade_ajax_upgradestep_backup_theme');
add_action('wp_ajax_wpgrade_upgradestep_analyze_download_options', 'wpgrade_ajax_upgradestep_analyze_download_options');
add_action('wp_ajax_wpgrade_upgradestep_download_package', 'wpgrade_ajax_upgradestep_download_package');
add_action('wp_ajax_wpgrade_upgradestep_install_package', 'wpgrade_ajax_upgradestep_install_package');
if (is_admin() && basename($_SERVER["PHP_SELF"]) != 'update-core.php') {
add_action('admin_enqueue_scripts', 'wpgrade_callback_update_notifier_admin_initialization');
add_action('admin_menu', 'wpgrade_callback_update_notifier_menu');
add_action('admin_bar_menu', 'wpgrade_callback_update_notifier_bar_menu', 1000);
示例6: __construct
function __construct()
{
$db_key_name = wpgrade::confoption('shortname', 'redux') . '_options';
//add_filter( 'redux/options/bucket_options/args', array( $this, 'wpgrade_make_redux_wpml_ready'), 1, 1 );
add_action('redux/construct', array($this, 'wpgrade_make_redux_wpml_ready'));
}
示例7: apply_filters
if ($folder === '.' or $folder === '..' or !is_dir($path . $folder)) {
continue;
}
$extension_class = 'ReduxFramework_Extension_' . $folder;
if (!class_exists($extension_class)) {
// In case you wanted override your override, hah.
$class_file = $path . $folder . '/extension_' . $folder . '.php';
$class_file = apply_filters('redux/extension/' . $ReduxFramework->args['opt_name'] . '/' . $folder, $class_file);
if (file_exists($class_file)) {
require_once $class_file;
$extension = new $extension_class($ReduxFramework);
}
}
}
}
$redux_opt_name = wpgrade::confoption('shortname', 'redux') . '_options';
add_action("redux/extensions/{$redux_opt_name}/before", 'wpgrade_register_custom_extension_loader', 0);
}
add_action('redux/page/' . wpgrade::$shortname . '_options/sections/after', 'wpgrade_hook_after_redux_sections');
function wpgrade_hook_after_redux_sections()
{
echo '<h3 id="floating-title"></h3>';
}
add_action('redux/options/' . wpgrade::$shortname . '_options/settings/change', 'wpgrade_hook_after_redux_save_btn');
function wpgrade_hook_after_redux_save_btn()
{
echo '<div class="reset-menu_wrapper"><label class="reset-menu_cog" for="reset-menu_trigger"><i class="icon-cog-1"></i></label><input type="checkbox" id="reset-menu_trigger" />';
echo '<div class="reset-menu"><ul class="reset-menu_list"><li>';
submit_button(__('Reset Section', 'redux-framework'), 'secondary', wpgrade::$shortname . '_options' . '[defaults-section]', false);
echo '</li><li>';
submit_button(__('Reset All', 'redux-framework'), 'secondary', wpgrade::$shortname . '_options' . '[defaults]', false);
示例8: set_menus
function set_menus()
{
//get all registered menu locations
$locations = get_theme_mod('nav_menu_locations');
//get all created menus
$wpGrade_menus = wp_get_nav_menus();
//get the configuration
$menu_conf = wpgrade::confoption('import_nav_menu');
if (!empty($wpGrade_menus) && !empty($menu_conf)) {
foreach ($wpGrade_menus as $wpGrade_menu) {
//check if we got a menu that corresponds to the Menu name array ($wpGrade_config->get('nav_menus')) we have set in menus.php
if (is_object($wpGrade_menu) && in_array($wpGrade_menu->name, $menu_conf)) {
$key = array_search($wpGrade_menu->name, $menu_conf);
if ($key !== false) {
//if we have found a menu with the correct menu name apply the id to the menu location
$locations[$key] = $wpGrade_menu->term_id;
}
}
}
}
//update the theme with the new menus in the right location
set_theme_mod('nav_menu_locations', $locations);
return true;
}
示例9: resourceuri
/**
* @return string uri to resource file
*/
static function resourceuri($file)
{
return wpgrade::uri(wpgrade::confoption('resource-path', 'theme-content') . '/' . ltrim($file, '/'));
}