/** * 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(); } } }
/** * 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'); } }
/** * Hijack and modify default Page Attributes meta box. * * @since 2.0.0 */ function themeblvd_page_attributes_meta_box($post) { // Kill it if disabled if (!themeblvd_supports('meta', 'hijack_atts')) { return false; } // Continue on with everything copied from WordPress core $post_type_object = get_post_type_object($post->post_type); if ($post_type_object->hierarchical) { $pages = wp_dropdown_pages(array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)', 'themeblvd'), 'sort_column' => 'menu_order, post_title', 'echo' => 0)); if (!empty($pages)) { ?> <p><strong><?php _e('Parent', 'themeblvd'); ?> </strong></p> <label class="screen-reader-text" for="parent_id"><?php _e('Parent', 'themeblvd'); ?> </label> <?php echo $pages; } // end empty pages check } // end hierarchical check. if ('page' == $post->post_type && 0 != count(get_page_templates())) { $template = !empty($post->page_template) ? $post->page_template : false; ?> <p><strong><?php _e('Template', 'themeblvd'); ?> </strong></p> <label class="screen-reader-text" for="page_template"><?php _e('Page Template', 'themeblvd'); ?> </label><select name="page_template" id="page_template"> <option value='default'><?php _e('Default Template', 'themeblvd'); ?> </option> <?php page_template_dropdown($template); ?> </select> <?php } /*-----------------------------------------------------------------------------------*/ /* ThemeBlvd Modifications (start) /*-----------------------------------------------------------------------------------*/ $sidebar_layout = get_post_meta($post->ID, '_tb_sidebar_layout', true); echo themeblvd_sidebar_layout_dropdown($sidebar_layout); // Custom layout selection removed as of Layout Builder v1.1, as now it's selected from a custom metabox. // $custom_layout = get_post_meta( $post->ID, '_tb_custom_layout', true ); // echo themeblvd_custom_layout_dropdown( $custom_layout ); /*-----------------------------------------------------------------------------------*/ /* ThemeBlvd Modifications (end) /*-----------------------------------------------------------------------------------*/ ?> <p><strong><?php _e('Order', 'themeblvd'); ?> </strong></p> <p><label class="screen-reader-text" for="menu_order"><?php _e('Order', 'themeblvd'); ?> </label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order); ?> " /></p> <p><?php if ('page' == $post->post_type) { _e('Need help? Use the Help tab in the upper right of your screen.', 'themeblvd'); } ?> </p> <?php }
/** * Saved data from Hi-jacked "Page Attributes" * meta box. * * @since 2.0.0 */ function themeblvd_save_page_atts($post_id) { if (themeblvd_supports('meta', 'hijack_atts')) { // Save sidebar layout if (isset($_POST['_tb_sidebar_layout'])) { update_post_meta($post_id, '_tb_sidebar_layout', $_POST['_tb_sidebar_layout']); } // Save custom layout if (isset($_POST['_tb_custom_layout'])) { // backwards compat update_post_meta($post_id, '_tb_custom_layout', $_POST['_tb_custom_layout']); } } }
/** * Load framework's JS scripts * * To add scripts or remove unwanted scripts that you * know you won't need to maybe save some frontend load * time, this function can easily be re-done from a * child theme. * * (1) jQuery - Already registered by WP, and enqueued for most our scripts. * (2) Twitter Bootstrap - All Bootstrap JS plugins combiled. * (3) Magnific Popup - Handles all default lightbox functionality. * (4) Super Fish/Hover Intent - Used for primary navigation. * (5) FlexSlider - Responsive slider, controls framework's "standard" slider type. * (6) Roundabout - Carousel-style slider, controls framwork's "3D Carousel" slider type. * (7) Theme Blvd scripts - Anything used by the framework to set other items into motion. * (8) iOS Orientation Fix - Allows zooming to be enabled on [older] iOS devices while still * allowing auto adjustment when switching between landscape and portrait. * (9) Already registered by WP, enable commentform to show when visitor clicks "Reply" on comment. * * @since 2.0.0 */ function themeblvd_include_scripts() { global $themeblvd_framework_scripts; // Start framework scripts. This can be used declare the // $deps of any enque'd JS files intended to come after // the framework. $scripts = array('jquery'); // Register scripts -- These scripts are only enque'd as needed. wp_register_script('flexslider', TB_FRAMEWORK_URI . '/assets/js/flexslider.min.js', array('jquery'), '2.1', true); wp_register_script('roundabout', TB_FRAMEWORK_URI . '/assets/js/roundabout.min.js', array('jquery'), '1.1', true); wp_register_script('nivo', TB_FRAMEWORK_URI . '/assets/js/nivo.min.js', array('jquery'), '3.2', true); // Enque Scripts wp_enqueue_script('jquery'); if (themeblvd_supports('assets', 'bootstrap')) { $scripts[] = 'bootstrap'; wp_enqueue_script('bootstrap', TB_FRAMEWORK_URI . '/assets/plugins/bootstrap/js/bootstrap.min.js', array('jquery'), '2.3.2', true); } if (themeblvd_supports('assets', 'magnific_popup')) { $scripts[] = 'magnific_popup'; wp_enqueue_script('magnific_popup', TB_FRAMEWORK_URI . '/assets/js/magnificpopup.min.js', array('jquery'), '0.9.3', true); } if (themeblvd_supports('assets', 'superfish')) { $scripts[] = 'superfish'; wp_enqueue_script('hoverintent', TB_FRAMEWORK_URI . '/assets/js/hoverintent.min.js', array('jquery'), 'r7', true); wp_enqueue_script('superfish', TB_FRAMEWORK_URI . '/assets/js/superfish.min.js', array('jquery'), '1.7.4', true); } if (themeblvd_supports('assets', 'primary_js')) { $scripts[] = 'themeblvd'; wp_enqueue_script('themeblvd', TB_FRAMEWORK_URI . '/assets/js/themeblvd.min.js', array('jquery'), TB_FRAMEWORK_VERSION, true); // Localize primary themeblvd.js script. This allows us to pass any filterable // parameters through to our primary script. wp_localize_script('themeblvd', 'themeblvd', themeblvd_get_js_locals()); } // Final filter on framework script. $themeblvd_framework_scripts = apply_filters('themeblvd_framework_scripts', $scripts); // iOS Orientation (for older iOS devices, not supported by default) if (themeblvd_supports('display', 'responsive') && themeblvd_supports('assets', 'ios_orientation')) { wp_enqueue_script('ios-orientationchange-fix', TB_FRAMEWORK_URI . '/assets/js/ios-orientationchange-fix.js', true); } // Comments reply if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }
/** * Setup JavaScript localized strings for * themeblvd.js * * The filter "themeblvd_js_locals" * can be used to add/remove strings or other * variables we want to pass through to our primary * "themeblvd" script. * * @since 2.2.0 */ function themeblvd_get_js_locals() { // Start $locals array with any miscellaneous stuff $locals = array('thumb_animations' => 'true', 'featured_animations' => 'true', 'image_slide_animations' => 'true', 'retina_logo' => 'true'); // Extend $locals to accomodate scripts being included // through our "themeblvd_global_config" filter. // This allows people to remove jQuery plugin files // w/out having to also remove functions from themeblvd.js. if (themeblvd_supports('assets', 'bootstrap')) { $locals['bootstrap'] = 'true'; } // Magnific Popup Lightbox integration if (themeblvd_supports('assets', 'magnific_popup')) { $locals['magnific_popup'] = 'true'; // Magnific Popup animation $locals['lightbox_animation'] = themeblvd_get_option('lightbox_animation'); // Disable standard lightbox on mobile? if ('yes' == themeblvd_get_option('lightbox_mobile')) { $locals['lightbox_mobile'] = '768'; } else { $locals['lightbox_mobile'] = '0'; } // Disable iframe lightboxes (i.e. video, google maps) on mobile? if ('yes' == themeblvd_get_option('lightbox_mobile_iframe')) { $locals['lightbox_mobile_iframe'] = '768'; } else { $locals['lightbox_mobile_iframe'] = '0'; } // Disable gallery lightboxes on mobile? if ('yes' == themeblvd_get_option('lightbox_mobile_gallery')) { $locals['lightbox_mobile_gallery'] = '768'; } else { $locals['lightbox_mobile_gallery'] = '0'; } // Text strings $locals['lightbox_error'] = themeblvd_get_local('lightbox_error'); $locals['lightbox_close'] = themeblvd_get_local('close'); $locals['lightbox_loading'] = themeblvd_get_local('loading'); $locals['lightbox_counter'] = themeblvd_get_local('lightbox_counter'); $locals['lightbox_next'] = themeblvd_get_local('next'); $locals['lightbox_previous'] = themeblvd_get_local('previous'); } // Superfish for drop down menus if (themeblvd_supports('assets', 'superfish')) { $locals['superfish'] = 'true'; } // Return with framework's filter applied return apply_filters('themeblvd_js_locals', $locals); }
<div id="content" class="<?php echo themeblvd_get_column_class('content'); ?> clearfix" role="main"> <div class="inner"> <?php themeblvd_content_top(); ?> <?php get_template_part('content', 'template_sitemap'); ?> <?php if (themeblvd_supports('comments', 'pages')) { ?> <?php comments_template('', true); ?> <?php } ?> <?php themeblvd_content_bottom(); ?> </div><!-- .inner (end) --> </div><!-- #content (end) --> <!-- CONTENT (end) -->
/** * Set primary configuration array. * * @since 2.3.0 */ public function set_config() { global $post; $this->config = array('id' => 0, 'builder' => false, 'builder_post_id' => 0, 'sidebar_layout' => '', 'featured' => array(), 'featured_below' => array(), 'sidebars' => array()); /*------------------------------------------------------*/ /* Primary Post ID /*------------------------------------------------------*/ // Store the ID of the original $post object in case // we modify the main query or need to ever access it. if (is_object($post)) { $this->config['id'] = $post->ID; } /*------------------------------------------------------*/ /* Custom Layout, Builder Name/ID /*------------------------------------------------------*/ if (defined('TB_BUILDER_PLUGIN_VERSION')) { $layout_name = ''; // Custom Layout on static page if (is_page_template('template_builder.php')) { if (post_password_required() || 'private' == get_post_status() && !current_user_can('edit_posts')) { // Password is currently required and so // the custom layout doesn't get used. $layout_name = 'wp-private'; } else { $layout_name = get_post_meta($this->config['id'], '_tb_custom_layout', true); if (!$layout_name) { $layout_name = 'error'; } } } // Custom Layout over home "posts page" if (is_home() && get_option('show_on_front') == 'posts') { if ('custom_layout' == themeblvd_get_option('homepage_content')) { $layout_name = themeblvd_get_option('homepage_custom_layout'); if (!$layout_name) { $layout_name = 'error'; } } } // Set name, which can also be "error" or "wp-private" $this->config['builder'] = $layout_name; // If we have a layout name, setup it's ID and sidebar layout if ($layout_name && $layout_name != 'error' && $layout_name != 'wp-private') { // Set ID $this->config['builder_post_id'] = themeblvd_post_id_by_name($layout_name, 'tb_layout'); // Sidebar layout $layout_settings = get_post_meta($this->config['builder_post_id'], 'settings', true); $this->config['sidebar_layout'] = $layout_settings['sidebar_layout']; } } /*------------------------------------------------------*/ /* Featured Area /*------------------------------------------------------*/ // For the featured area above or below the content to be // enabled, it must contain at least one CSS class or else // it won't be displayed for the current page. if ($this->config['builder'] && $this->config['builder'] != 'error' && $this->config['builder'] != 'wp-private') { $elements = get_post_meta($this->config['builder_post_id'], 'elements', true); $this->config['featured'] = $this->featured_builder_classes($elements, 'featured'); $this->config['featured_below'] = $this->featured_builder_classes($elements, 'featured_below'); } if (is_home()) { if ('custom_layout' != themeblvd_get_option('homepage_content')) { if (themeblvd_get_option('blog_featured') || themeblvd_supports('featured', 'blog')) { $this->config['featured'][] = 'has_blog_featured'; } if (themeblvd_supports('featured_below', 'blog')) { $this->config['featured_below'][] = 'has_blog_featured_below'; } } } if (is_page_template('template_list.php')) { if (themeblvd_get_option('blog_featured') || themeblvd_supports('featured', 'blog')) { $this->config['featured'][] = 'has_blog_featured'; } if (themeblvd_supports('featured_below', 'blog')) { $this->config['featured_below'][] = 'has_blog_featured_below'; } } if (is_page_template('template_grid.php')) { if (themeblvd_supports('featured', 'grid')) { $this->config['featured'][] = 'has_grid_featured'; } if (themeblvd_supports('featured_below', 'grid')) { $this->config['featured_below'][] = 'has_grid_featured_below'; } } if (is_archive() || is_search()) { if (themeblvd_supports('featured', 'archive')) { $this->config['featured'][] = 'has_archive_featured'; } if (themeblvd_supports('featured_below', 'archive')) { $this->config['featured_below'][] = 'has_archive_featured_below'; } } if (is_page() && !is_page_template('template_builder.php')) { if (themeblvd_supports('featured', 'page')) { $this->config['featured'][] = 'has_page_featured'; } if (themeblvd_supports('featured_below', 'page')) { $this->config['featured_below'][] = 'has_page_featured_below'; } } if (is_single()) { if (themeblvd_supports('featured', 'single')) { $this->config['featured'][] = 'has_single_featured'; } if (themeblvd_supports('featured_below', 'single')) { $this->config['featured_below'][] = 'has_single_featured_below'; } } /*------------------------------------------------------*/ /* Sidebar Layout /*------------------------------------------------------*/ // The sidebar layout is how the left and right sidebar will // be displayed on the current page. if (!$this->config['sidebar_layout'] && (is_page() || is_single())) { $this->config['sidebar_layout'] = get_post_meta($this->config['id'], '_tb_sidebar_layout', true); } if (!$this->config['sidebar_layout'] || 'default' == $this->config['sidebar_layout']) { $this->config['sidebar_layout'] = themeblvd_get_option('sidebar_layout'); } if (!$this->config['sidebar_layout']) { $this->config['sidebar_layout'] = apply_filters('themeblvd_default_sidebar_layout', 'sidebar_right', $this->config['sidebar_layout']); // Keeping for backwards compatibility, although is redundant with next filter. } $this->config['sidebar_layout'] = apply_filters('themeblvd_sidebar_layout', $this->config['sidebar_layout']); /*------------------------------------------------------*/ /* Sidebar ID's /*------------------------------------------------------*/ // Determine which sidebar ID's belong to each sidebar location // on the current page. For each location, this will be the // framework's cooresponding default sidebar, unless something // else is filtered in. -- Note: The Widget Areas plugin filters // into this. $locations = themeblvd_get_sidebar_locations(); $custom_sidebars = defined('TB_SIDEBARS_PLUGIN_VERSION') ? get_posts('post_type=tb_sidebar&numberposts=-1') : null; $sidebar_overrides = defined('TB_SIDEBARS_PLUGIN_VERSION') ? get_post_meta($this->config['id'], '_tb_sidebars', true) : null; foreach ($locations as $location_id => $default_sidebar) { // By default, the sidebar ID will match the ID of the // current location. $sidebar_id = apply_filters('themeblvd_custom_sidebar_id', $location_id, $custom_sidebars, $sidebar_overrides, $this->config['id']); // Set current sidebar ID $this->config['sidebars'][$location_id]['id'] = $sidebar_id; $this->config['sidebars'][$location_id]['error'] = false; // Determine sidebar error (i.e. sidebar is empty) if (!is_active_sidebar($sidebar_id)) { if ($default_sidebar['type'] == 'collapsible') { // Only an error if collapsible sidebar is custom. if ($sidebar_id != $location_id) { $this->config['sidebars'][$location_id]['error'] = true; } } else { // Custom or not, we need to tell the user if a // fixed sidebar is empty. $this->config['sidebars'][$location_id]['error'] = true; } } } /*------------------------------------------------------*/ /* Extend /*------------------------------------------------------*/ $this->config = apply_filters('themeblvd_frontend_config', $this->config); }
/** * 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 viewport meta to wp_head if responsive * design is enabled in framework. * * @since 2.2.0 */ function themeblvd_viewport_default() { if (themeblvd_supports('display', 'responsive')) { echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n"; } }
<div class="inner"> <?php themeblvd_content_top(); ?> <?php while (have_posts()) { the_post(); ?> <?php get_template_part('content', 'attachment'); ?> <?php if (themeblvd_supports('comments', 'attachments')) { ?> <?php comments_template('', true); ?> <?php } ?> <?php } ?> <?php themeblvd_content_bottom(); ?>
/** * Set framework stylesheets * * @since 2.3.0 */ public function set_framework_stylesheets() { $this->framework_stylesheets = array(); // Bootstrap/FontAwesome if (themeblvd_supports('assets', 'bootstrap')) { // Boostrap $this->framework_stylesheets['bootstrap'] = array('handle' => 'bootstrap', 'src' => TB_FRAMEWORK_URI . '/assets/plugins/bootstrap/css/bootstrap.min.css', 'deps' => array(), 'ver' => '2.3.2', 'media' => 'all'); // FontAwesome $this->framework_stylesheets['fontawesome'] = array('handle' => 'fontawesome', 'src' => TB_FRAMEWORK_URI . '/assets/plugins/fontawesome/css/font-awesome.min.css', 'deps' => array(), 'ver' => '3.2.1', 'media' => 'all'); } // Magnific Popup if (themeblvd_supports('assets', 'magnific_popup')) { $this->framework_stylesheets['magnific_popup'] = array('handle' => 'magnific_popup', 'src' => TB_FRAMEWORK_URI . '/assets/css/magnificpopup.min.css', 'deps' => array(), 'ver' => '0.9.3', 'media' => 'all'); } // Primary framework styles if (themeblvd_supports('assets', 'primary_css')) { $this->framework_stylesheets['themeblvd'] = array('handle' => 'themeblvd', 'src' => TB_FRAMEWORK_URI . '/assets/css/themeblvd.min.css', 'deps' => array(), 'ver' => TB_FRAMEWORK_VERSION, 'media' => 'all'); } // Remove stylesheets if ($this->remove_stylesheets) { foreach ($this->remove_stylesheets as $key => $handle) { if (isset($this->framework_stylesheets[$handle])) { // Remove framework stylesheet unset($this->framework_stylesheets[$handle]); // Now that we've found the stylesheet and removed it, // we don't need to de-register it later. unset($this->remove_stylesheets[$key]); } } } // Set framework $deps if ($this->framework_stylesheets) { foreach ($this->framework_stylesheets as $handle => $args) { $this->framework_deps[] = $handle; } } // Backwards compat for $deps $GLOBALS['themeblvd_framework_stylesheets'] = apply_filters('themeblvd_framework_stylesheets', $this->framework_deps); }
/** * 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')); } }