/** * Run Widget Area Manager * * In order for everything to run, we need to make * sure Theme Blvd framework v2.2+ is running. Also * to run the admin panel portion, we will also check * to make sure the user is allowed. -- This supports * the framework's filters on changing admin page * capabilities. * * @since 1.0.0 */ function themeblvd_sidebars_init() { global $_themeblvd_sidebar_manager; // Include general functions include_once TB_SIDEBARS_PLUGIN_DIR . '/includes/general.php'; // Check to make sure Theme Blvd Framework 2.2+ is running if (!defined('TB_FRAMEWORK_VERSION') || version_compare(TB_FRAMEWORK_VERSION, '2.2.0', '<')) { add_action('admin_notices', 'themeblvd_sidebars_warning'); return; } // If using framework v2.2.0, tell them they should now update to 2.2.1 if (version_compare(TB_FRAMEWORK_VERSION, '2.2.0', '=')) { add_action('admin_notices', 'themeblvd_sidebars_warning_2'); } // If user has a version of TB framework that doesn't have the nag disable yet, hook in our's if (!function_exists('themeblvd_disable_nag')) { add_action('admin_init', 'themeblvd_sidebars_disable_nag'); } // General actions and filters add_action('init', 'themeblvd_sidebars_register_post_type'); add_action('after_setup_theme', 'themeblvd_register_custom_sidebars', 1001); // Hooked directly after theme framework's sidebar registration add_filter('themeblvd_custom_sidebar_id', 'themeblvd_get_sidebar_id', 10, 3); // This filter happens in the theme framework's themeblvd_frontend_init() // Admin files, actions, and filters if (is_admin()) { // Check to make sure admin interface isn't set to be // hidden and for the appropriate user capability if (themeblvd_supports('admin', 'sidebars') && current_user_can(themeblvd_admin_module_cap('sidebars'))) { include_once TB_SIDEBARS_PLUGIN_DIR . '/includes/admin/class-tb-sidebar-manager.php'; $_themeblvd_sidebar_manager = new Theme_Blvd_Sidebar_Manager(); } } }
/** * Add a subpages for Sidebars to the appearance menu. * * @since 1.0.0 */ public function add_page() { $title = __('Widget Areas', 'themeblvd_sidebars'); $admin_page = add_theme_page($title, $title, themeblvd_admin_module_cap('sidebars'), 'themeblvd_widget_areas', array($this, 'admin_page')); add_action('admin_print_styles-' . $admin_page, array($this, 'load_styles')); add_action('admin_print_scripts-' . $admin_page, array($this, 'load_scripts')); // @deprecated add_action( 'admin_print_styles-'.$admin_page, 'optionsframework_mlu_css', 0 ); // @deprecated add_action( 'admin_print_scripts-'.$admin_page, 'optionsframework_mlu_js', 0 ); }
/** * Add admin page * * @since 1.0.0 */ public function add_page() { // Create new admin page $admin_page = add_object_page('Slider Manager', 'Sliders', themeblvd_admin_module_cap('sliders'), 'themeblvd_sliders', array($this, 'admin_page'), 'div', 31); // Attach assets to new admin page add_action('admin_print_styles-' . $admin_page, array($this, 'load_styles')); add_action('admin_print_scripts-' . $admin_page, array($this, 'load_scripts')); // Media Uploader fallback if (!function_exists('wp_enqueue_media') || !function_exists('themeblvd_media_uploader')) { add_action('admin_print_styles-' . $admin_page, 'optionsframework_mlu_css', 0); add_action('admin_print_scripts-' . $admin_page, 'optionsframework_mlu_js', 0); } }
/** * Run Sliders Plugin * * @since 1.0.0 */ function themeblvd_sliders_init() { global $_themeblvd_sliders_admin; // Include general functions include_once TB_SLIDERS_PLUGIN_DIR . '/includes/general.php'; // Check to make sure Theme Blvd Framework 2.2+ is running if (!defined('TB_FRAMEWORK_VERSION') || version_compare(TB_FRAMEWORK_VERSION, '2.2.0', '<')) { add_action('admin_notices', 'themeblvd_sliders_warning'); add_action('admin_init', 'themeblvd_sliders_disable_nag'); return; } // Register post type add_action('init', 'themeblvd_sliders_register_post_type'); // Separate frontend and admin sections if (is_admin()) { if (themeblvd_supports('admin', 'sliders') && current_user_can(themeblvd_admin_module_cap('sliders'))) { include_once TB_SLIDERS_PLUGIN_DIR . '/includes/admin/class-tb-sliders-admin.php'; $_themeblvd_sliders_admin = new Theme_Blvd_Sliders_Admin(); } } else { include_once TB_SLIDERS_PLUGIN_DIR . '/includes/sliders-helpers.php'; include_once TB_SLIDERS_PLUGIN_DIR . '/includes/sliders-display.php'; // Standard slider add_action('themeblvd_standard_slider_plugin_js', 'themeblvd_standard_slider_js', 10, 2); add_action('themeblvd_standard_slider', 'themeblvd_standard_slider_default', 9, 4); // JS located within the theme because also works with other elements add_action('themeblvd_slider_auto', 'themeblvd_standard_slider_default', 9, 3); add_filter('themeblvd_sliders_custom_content', 'stripslashes'); add_filter('themeblvd_sliders_custom_content', 'do_shortcode'); // Carrousel slider add_action('themeblvd_carrousel_slider', 'themeblvd_carrousel_slider_default', 9, 3); add_action('themeblvd_carrousel_slider_js', 'themeblvd_carrousel_slider_js_default', 10, 2); // Nivo slider add_action('themeblvd_nivo_slider', 'themeblvd_nivo_slider_default', 9, 3); add_action('themeblvd_nivo_slider_js', 'themeblvd_nivo_slider_js_default', 10, 2); // Bootstrap slider add_action('themeblvd_bootstrap_slider', 'themeblvd_bootstrap_slider_default', 9, 3); // General slider fallback add_action('themeblvd_slider_fallback', 'themeblvd_slider_fallback_default', 10, 3); // Slider shortcodes add_shortcode('slider', 'themeblvd_shortcode_slider'); add_shortcode('post_slider', 'themeblvd_shortcode_slider_auto'); } }
/** * Initialize anything needed for admin panel to run. * * @since 2.0.0 */ function themeblvd_admin_init() { // Allow theme options page to run if framework filters // have don't have it hidden it and user is capable. if (themeblvd_supports('admin', 'options') && current_user_can(themeblvd_admin_module_cap('options'))) { // Access Options API, instance should already be created. $api = Theme_Blvd_Options_API::get_instance(); // Option ID the theme options are registered and // saved to. -- i.e. get_option( $option_name ) $option_id = $api->get_option_id(); // All options constructed from framework and // potentially added to by client API. $options = $api->get_formatted_options(); // Arguments for theme options admin page. // Filterable with "themeblvd_theme_options_args" $args = $api->get_args(); // Theme Options Page $options_page = new Theme_Blvd_Options_Page($option_id, $options, $args); } }
/** * Constructor. * * @since 2.2.0 * * @param string $id A unique ID for this admin page * @param array $options Options for admin page * @param array $args Arguments to setup various elements of the admin page */ public function __construct($id, $options, $args = null) { // Arguments $defaults = array('parent' => 'themes.php', 'page_title' => __('Theme Options', 'themeblvd'), 'menu_title' => __('Theme Options', 'themeblvd'), 'cap' => themeblvd_admin_module_cap('options'), 'menu_slug' => '', 'icon' => '', 'form_action' => 'options.php', 'closer' => true); $this->args = wp_parse_args($args, $defaults); // Options page menu slug if (!$this->args['menu_slug']) { $this->args['menu_slug'] = $id; } // Option ID -- i.e. get_option( $id ) $this->id = $id; // Form options $this->options = $options; // Add admin page and register settings add_action('admin_menu', array($this, 'add_page')); add_action('admin_init', array($this, 'register')); // Legacy media uploader if (!function_exists('wp_enqueue_media')) { add_action('admin_init', 'optionsframework_mlu_init'); } }
/** * Constructor. * * @since 1.0.0 * * @param $id string Unique ID for admin page * @param $args array Arguments for admin page * @param $elements array Elements for layout builder */ public function __construct($id = 'themeblvd_builder', $args = array(), $elements = array()) { // ID for admin page $this->id = $id; // Setup arguments for admin page $defaults = array('page_title' => __('Layout Builder', 'themeblvd_builder'), 'menu_title' => __('Builder', 'themeblvd_builder'), 'icon' => 'div', 'cap' => themeblvd_admin_module_cap('builder'), 'priority' => 30); $this->args = wp_parse_args($args, $defaults); // Elements for builder $this->elements = $elements; // If elements passed in add_action('after_setup_theme', array($this, 'set_elements'), 1001); // After client API // Add Builder admin page add_action('admin_menu', array($this, 'add_page')); // Add Custom Layouts meta box add_action('add_meta_boxes', array($this, 'add_meta_box')); add_action('save_post', array($this, 'save_meta_box')); // Filter on javascript locals specifically for Builder onto // Theme Blvd framework locals. add_filter('themeblvd_locals_js', array($this, 'add_js_locals')); // Add ajax functionality to slider admin page $this->ajax = new Theme_Blvd_Layout_Builder_Ajax($this); }
/** * Setup everything we need for WordPress customizer. * * All custom controls used in this function can be * found in the following file: * * /framework/admin/classes/customizer.php * * @since 2.1.0 */ function themeblvd_customizer_init($wp_customize) { global $_themeblvd_customizer_sections; // Get current theme settings. $options_api = Theme_Blvd_Options_API::get_instance(); $option_name = $options_api->get_option_id(); $theme_settings = $options_api->get_setting(); // Register sections of options if ($_themeblvd_customizer_sections) { foreach ($_themeblvd_customizer_sections as $section) { // Add section $wp_customize->add_section($section['id'], array('title' => $section['name'], 'priority' => $section['priority'])); $font_counter = 1; // Add Options if ($section['options']) { foreach ($section['options'] as $option) { if ($option['type'] == 'logo') { // LOGO // Setup defaults $defaults = array('type' => '', 'custom' => '', 'custom_tagline' => '', 'image' => ''); if (isset($theme_settings[$option['id']])) { foreach ($defaults as $key => $value) { if (isset($theme_settings[$option['id']][$key])) { $defaults[$key] = $theme_settings[$option['id']][$key]; } } } // Transport $transport = ''; if (isset($option['transport'])) { $transport = $option['transport']; } // Logo Type $wp_customize->add_setting($option_name . '[' . $option['id'] . '][type]', array('default' => esc_attr($defaults['type']), 'type' => 'option', 'capability' => themeblvd_admin_module_cap('options'), 'transport' => $transport)); $wp_customize->add_control($option['id'] . '_type', array('priority' => 1, 'settings' => $option_name . '[' . $option['id'] . '][type]', 'label' => $option['name'] . ' ' . __('Type', 'themeblvd'), 'section' => $section['id'], 'type' => 'select', 'choices' => array('title' => __('Site Title', 'themeblvd'), 'title_tagline' => __('Site Title + Tagline', 'themeblvd'), 'custom' => __('Custom Text', 'themeblvd'), 'image' => __('Image', 'themeblvd')))); // Custom Title $wp_customize->add_setting($option_name . '[' . $option['id'] . '][custom]', array('default' => esc_attr($defaults['custom']), 'type' => 'option', 'capability' => themeblvd_admin_module_cap('options'), 'transport' => $transport)); $wp_customize->add_control($option['id'] . '_custom', array('priority' => 2, 'settings' => $option_name . '[' . $option['id'] . '][custom]', 'label' => __('Custom Title', 'themeblvd'), 'section' => $section['id'])); // Custom Tagline $wp_customize->add_setting($option_name . '[' . $option['id'] . '][custom_tagline]', array('default' => esc_attr($defaults['custom_tagline']), 'type' => 'option', 'capability' => themeblvd_admin_module_cap('options'), 'transport' => $transport)); $wp_customize->add_control($option['id'] . '_custom_tagline', array('priority' => 3, 'settings' => $option_name . '[' . $option['id'] . '][custom_tagline]', 'label' => __('Custom Tagline', 'themeblvd'), 'section' => $section['id'])); // Logo Image $wp_customize->add_setting($option_name . '[' . $option['id'] . '][image]', array('default' => esc_attr($defaults['image']), 'type' => 'option', 'capability' => themeblvd_admin_module_cap('options'), 'transport' => $transport)); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, $option['id'] . '_image', array('priority' => 4, 'settings' => $option_name . '[' . $option['id'] . '][image]', 'label' => $option['name'] . ' ' . __('Image', 'themeblvd'), 'section' => $section['id']))); } else { if ($option['type'] == 'typography') { // TYPOGRAPHY // Setup defaults $defaults = array('size' => '', 'style' => '', 'face' => '', 'style' => '', 'color' => '', 'google' => ''); if (isset($theme_settings[$option['id']])) { $defaults = $theme_settings[$option['id']]; } // Transport $transport = ''; if (isset($option['transport'])) { $transport = $option['transport']; } // Loop through included attributes foreach ($option['atts'] as $attribute) { // Register options $wp_customize->add_setting($option_name . '[' . $option['id'] . '][' . $attribute . ']', array('default' => esc_attr($defaults[$attribute]), 'type' => 'option', 'capability' => themeblvd_admin_module_cap('options'), 'transport' => $transport)); switch ($attribute) { case 'size': $size_options = array(); for ($i = 9; $i < 71; $i++) { $size = $i . 'px'; $size_options[$size] = $size; } $wp_customize->add_control($option['id'] . '_' . $attribute, array('priority' => $font_counter, 'settings' => $option_name . '[' . $option['id'] . '][' . $attribute . ']', 'label' => $option['name'] . ' ' . ucfirst($attribute), 'section' => $section['id'], 'type' => 'select', 'choices' => $size_options)); $font_counter++; break; case 'face': $wp_customize->add_control(new WP_Customize_ThemeBlvd_Font_Face($wp_customize, $option['id'] . '_' . $attribute, array('priority' => $font_counter, 'settings' => $option_name . '[' . $option['id'] . '][' . $attribute . ']', 'label' => $option['name'] . ' ' . ucfirst($attribute), 'section' => $section['id'], 'choices' => themeblvd_recognized_font_faces()))); $font_counter++; $wp_customize->add_setting($option_name . '[' . $option['id'] . '][google]', array('default' => esc_attr($defaults['google']), 'type' => 'option', 'capability' => themeblvd_admin_module_cap('options'), 'transport' => $transport)); $wp_customize->add_control(new WP_Customize_ThemeBlvd_Google_Font($wp_customize, $option['id'] . '_' . $attribute . '_google', array('priority' => $font_counter, 'settings' => $option_name . '[' . $option['id'] . '][google]', 'label' => __('Google Font Name', 'themeblvd'), 'section' => $section['id']))); $font_counter++; break; case 'style': $wp_customize->add_control($option['id'] . '_' . $attribute, array('priority' => $font_counter, 'settings' => $option_name . '[' . $option['id'] . '][' . $attribute . ']', 'label' => $option['name'] . ' ' . ucfirst($attribute), 'section' => $section['id'], 'type' => 'select', 'choices' => themeblvd_recognized_font_styles())); $font_counter++; break; case 'color': $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $option['id'] . '_' . $attribute, array('priority' => $font_counter, 'settings' => $option_name . '[' . $option['id'] . '][' . $attribute . ']', 'label' => $option['name'] . ' ' . ucfirst($attribute), 'section' => $section['id']))); $font_counter++; break; } // Divider line below each font $wp_customize->add_setting($option_name . '[' . $option['id'] . '][divider]', array('type' => 'option', 'capability' => themeblvd_admin_module_cap('options'), 'transport' => $transport)); $wp_customize->add_control(new WP_Customize_ThemeBlvd_Divider($wp_customize, $option['id'] . '_divider', array('priority' => $font_counter, 'settings' => $option_name . '[' . $option['id'] . '][divider]', 'section' => $section['id']))); $font_counter++; } } else { // ALL OTHER OPTIONS // Default $default = ''; if (isset($theme_settings[$option['id']])) { $default = $theme_settings[$option['id']]; } // Transport $transport = ''; if (isset($option['transport'])) { $transport = $option['transport']; } $priority = ''; if (isset($option['priority'])) { $priority = $option['priority']; } // Register option $wp_customize->add_setting($option_name . '[' . $option['id'] . ']', array('default' => esc_attr($default), 'type' => 'option', 'capability' => themeblvd_admin_module_cap('options'), 'transport' => $transport)); // Add controls switch ($option['type']) { // Standard text option case 'text': $wp_customize->add_control($option['id'], array('priority' => $priority, 'settings' => $option_name . '[' . $option['id'] . ']', 'label' => $option['name'], 'section' => $section['id'])); break; // Textarea // Textarea case 'textarea': $wp_customize->add_control(new WP_Customize_ThemeBlvd_Textarea($wp_customize, $option['id'], array('priority' => $priority, 'settings' => $option_name . '[' . $option['id'] . ']', 'label' => $option['name'], 'section' => $section['id']))); break; // Select box // Select box case 'select': $wp_customize->add_control($option['id'], array('priority' => $priority, 'settings' => $option_name . '[' . $option['id'] . ']', 'label' => $option['name'], 'section' => $section['id'], 'type' => 'select', 'choices' => $option['options'])); break; // Radio set // Radio set case 'radio': $wp_customize->add_control($option['id'], array('priority' => $priority, 'settings' => $option_name . '[' . $option['id'] . ']', 'label' => $option['name'], 'section' => $section['id'], 'type' => 'radio', 'choices' => $option['options'])); break; // Color // Color case 'color': $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $option['id'], array('priority' => $priority, 'settings' => $option_name . '[' . $option['id'] . ']', 'label' => $option['name'], 'section' => $section['id']))); break; } } } } } } } // Remove irrelevant sections $remove_sections = apply_filters('themeblvd_customizer_remove_sections', array('title_tagline')); if (is_array($remove_sections) && $remove_sections) { foreach ($remove_sections as $section) { $wp_customize->remove_section($section); } } // Modify sections $modify_sections = apply_filters('themeblvd_customizer_modify_sections', array()); if (!empty($modify_sections)) { foreach ($modify_sections as $section) { // Currently only one section set to be modified. I'm doing this // loop to make it so you can stop items from being modified and // I can may add to this in the future. switch ($section) { case 'static_front_page': // Modify section's title $wp_customize->add_section('static_front_page', array('title' => __('Homepage', 'themeblvd'), 'priority' => 120, 'description' => __('Your theme supports a static front page.', 'themeblvd'))); // Add custom homepage option $wp_customize->add_setting($option_name . '[homepage_content]', array('default' => '', 'type' => 'option', 'capability' => themeblvd_admin_module_cap('options'))); $wp_customize->add_control('homepage_content', array('settings' => $option_name . '[homepage_content]', 'label' => __('Homepage Content', 'themeblvd'), 'section' => 'static_front_page', 'type' => 'radio', 'choices' => array('posts' => __('WordPress Default', 'themeblvd'), 'custom_layout' => __('Custom Layout', 'themeblvd')))); // Add custom layout selection // Custom Layouts $custom_layouts = array(); $custom_layout_posts = get_posts('post_type=tb_layout&numberposts=-1'); if (!empty($custom_layout_posts)) { foreach ($custom_layout_posts as $layout) { $custom_layouts[$layout->post_name] = $layout->post_title; } } else { $custom_layouts['null'] = __('You haven\'t created any custom layouts yet.', 'themeblvd'); } $wp_customize->add_setting($option_name . '[homepage_custom_layout]', array('default' => '', 'type' => 'option', 'capability' => themeblvd_admin_module_cap('options'))); $wp_customize->add_control('homepage_custom_layout', array('settings' => $option_name . '[homepage_custom_layout]', 'label' => __('Homepage Custom Layout', 'themeblvd'), 'section' => 'static_front_page', 'type' => 'select', 'choices' => $custom_layouts)); break; } } } }
/** * Set $args to be used for Theme_Blvd_Options_Page * class instance for our main theme options page. * * @since 2.3.0 */ public function set_args() { $this->args = array('parent' => 'themes.php', 'page_title' => __('Theme Options', 'themeblvd'), 'menu_title' => __('Theme Options', 'themeblvd'), 'cap' => themeblvd_admin_module_cap('options'), 'menu_slug' => $this->get_option_id(), 'icon' => '', 'closer' => true); $this->args = apply_filters('themeblvd_theme_options_args', $this->args); }
/** * Run Layout Builder plugin * * @since 1.0.0 */ function themeblvd_builder_init() { global $_themeblvd_layout_builder; // Include general functions include_once TB_BUILDER_PLUGIN_DIR . '/includes/general.php'; // Check to make sure Theme Blvd Framework 2.2+ is running if (!defined('TB_FRAMEWORK_VERSION') || version_compare(TB_FRAMEWORK_VERSION, '2.2.0', '<')) { add_action('admin_notices', 'themeblvd_builder_warning'); add_action('admin_init', 'themeblvd_builder_disable_nag'); return; } // If using framework v2.2.0, tell them they should now update to 2.2.1 if (version_compare(TB_FRAMEWORK_VERSION, '2.2.0', '=')) { add_action('admin_notices', 'themeblvd_builder_warning_2'); } // If using framework version prior to v2.3, tell them API functions won't work. if (version_compare(TB_FRAMEWORK_VERSION, '2.3.0', '<')) { add_action('admin_notices', 'themeblvd_builder_warning_3'); } // Hook in check for nag to dismiss. add_action('admin_init', 'themeblvd_builder_disable_nag'); // Register custom layout hidden post type add_action('init', 'themeblvd_builder_register_post_type'); // Frontend actions -- These work in conjuction with framework theme files, // header.php, template_builder.php, and footer.php add_action('themeblvd_builder_content', 'themeblvd_builder_content'); add_action('themeblvd_featured', 'themeblvd_builder_featured'); add_action('themeblvd_featured_below', 'themeblvd_builder_featured_below'); // Get custom layouts $custom_layouts = array(); if (is_admin()) { $custom_layout_posts = get_posts('post_type=tb_layout&orderby=title&order=ASC&numberposts=-1'); if (!empty($custom_layout_posts)) { foreach ($custom_layout_posts as $layout) { $custom_layouts[$layout->post_name] = $layout->post_title; } } else { $custom_layouts['null'] = __('You haven\'t created any custom layouts yet.', 'themeblvd'); } } // Add option to theme options page allowing user to // select custom layout for their homepage. $options = array('homepage_content' => array('name' => __('Homepage Content', 'themeblvd_builder'), 'desc' => __('Select the content you\'d like to show on your homepage. Note that for this setting to take effect, you must go to Settings > Reading > Frontpage displays, and select "your latest posts."', 'themeblvd_builder'), 'id' => 'homepage_content', 'std' => 'posts', 'type' => 'radio', 'options' => array('posts' => __('Posts', 'themeblvd_builder'), 'custom_layout' => __('Custom Layout', 'themeblvd_builder'))), 'homepage_custom_layout' => array('name' => __('Select Custom Layout', 'themeblvd_builder'), 'desc' => __('Select from the custom layouts you\'ve built under the <a href="admin.php?page=themeblvd_builder">Builder</a> section.', 'themeblvd_builder'), 'id' => 'homepage_custom_layout', 'std' => '', 'type' => 'select', 'options' => $custom_layouts)); themeblvd_add_option_section('content', 'homepage', __('Homepage', 'themeblvd_builder'), null, $options, true); // Filter homepage content according to options section // we added above. add_filter('template_include', 'themeblvd_builder_homepage'); // Trigger customizer support for custom homepage options. add_filter('themeblvd_customizer_modify_sections', 'themeblvd_modify_customizer_homepage'); // Admin Layout Builder if (is_admin()) { // Check to make sure admin interface isn't set to be // hidden and for the appropriate user capability if (themeblvd_supports('admin', 'builder') && current_user_can(themeblvd_admin_module_cap('builder'))) { include_once TB_BUILDER_PLUGIN_DIR . '/includes/admin/builder-samples.php'; include_once TB_BUILDER_PLUGIN_DIR . '/includes/admin/class-tb-layout-builder-ajax.php'; include_once TB_BUILDER_PLUGIN_DIR . '/includes/admin/class-tb-layout-builder.php'; $_themeblvd_layout_builder = new Theme_Blvd_Layout_Builder(); } } }
/** * Add items to admin menu bar. This needs to be here in general * functions because admin bar appears on frontend as well. * * @since 2.0.0 */ function themeblvd_admin_menu_bar() { global $wp_admin_bar; if (is_admin() || !method_exists($wp_admin_bar, 'add_node')) { return; } // Get all admin modules $modules = themeblvd_get_admin_modules(); if (!$modules) { return; } // Theme Options if (isset($modules['options']) && themeblvd_supports('admin', 'options') && current_user_can(themeblvd_admin_module_cap('options'))) { $wp_admin_bar->add_node(array('id' => 'tb_theme_options', 'title' => __('Theme Options', 'themeblvd'), 'parent' => 'site-name', 'href' => admin_url($modules['options']))); } // Sliders (if sliders plugin is installed) if (defined('TB_SLIDERS_PLUGIN_VERSION') && isset($modules['sliders'])) { if (themeblvd_supports('admin', 'sliders') && current_user_can(themeblvd_admin_module_cap('sliders'))) { $wp_admin_bar->add_node(array('id' => 'tb_sliders', 'title' => __('Sliders', 'themeblvd'), 'parent' => 'site-name', 'href' => admin_url($modules['sliders']))); } } // Builder (if layout builder plugin is installed) if (defined('TB_BUILDER_PLUGIN_VERSION') && isset($modules['builder'])) { if (themeblvd_supports('admin', 'builder') && current_user_can(themeblvd_admin_module_cap('builder'))) { $wp_admin_bar->add_node(array('id' => 'tb_builder', 'title' => __('Layout Builder', 'themeblvd'), 'parent' => 'site-name', 'href' => admin_url($modules['builder']))); } } // Sidebars (if sidebar plugin is installed) if (defined('TB_SIDEBARS_PLUGIN_VERSION') && isset($modules['sidebars'])) { if (themeblvd_supports('admin', 'sidebars') && current_user_can(themeblvd_admin_module_cap('sidebars'))) { $wp_admin_bar->add_node(array('id' => 'tb_sidebars', 'title' => __('Widget Areas', 'themeblvd'), 'parent' => 'site-name', 'href' => admin_url($modules['sidebars']))); } } }
/** * Add admin page. */ function add_page() { if (themeblvd_supports('admin', 'updates') && current_user_can(themeblvd_admin_module_cap('updates'))) { add_theme_page(__('Theme License', 'themeblvd'), __('Theme License', 'themeblvd'), 'manage_options', 'themeblvd-license', array($this, 'admin_page')); } }