/** * Get class used to determine width of column in primary layout. * * @since 2.2.0 * * @param string $column Which column to retrieve class for * @return string $column_class The class to be used in grid system */ function themeblvd_get_column_class($column) { $column_class = ''; $sidebar_layouts = themeblvd_sidebar_layouts(); $current_sidebar_layout = themeblvd_config('sidebar_layout'); if (isset($sidebar_layouts[$current_sidebar_layout]['columns'][$column])) { $column_class = $sidebar_layouts[$current_sidebar_layout]['columns'][$column]; } return apply_filters('themeblvd_column_class', $column_class); }
/** * Display Sidebar * * @since 2.3.0 * * @param string $location Location ID for the sidebar to display */ public function display($location) { // Setup type if (!isset($this->locations[$location]['type'])) { return; } $type = $this->locations[$location]['type']; // Current configuration for sidebar $sidebar = themeblvd_config('sidebars', $location); // If sidebar is set to false or sidebar doesn't // exist, kill it. if (!$sidebar) { return; } // If this is a collapsible default sidebar with // no errors, we'll want to just kill it if it // has no widgets. if ($type == 'collapsible' && !$sidebar['error'] && !is_active_sidebar($sidebar['id'])) { return; } // Start display. do_action('themeblvd_sidebar_' . $type . '_before'); // Framework does not hook anything here by default do_action('themeblvd_sidebar_' . $location . '_before'); // Framework does not hook anything here by default echo '<div class="widget-area widget-area-' . $type . '">'; // Proceed, but check for error if ($sidebar['error']) { // Only show error message if user is logged in. if (is_user_logged_in()) { // Set message switch ($type) { case 'collapsible': $message = sprintf(__('This is a collapsible widget area with ID, <strong>%s</strong>, but you haven\'t put any widgets in it yet. Normally this wouldn\'t show at all when empty, but since you have assigned a custom widget area here and didn\'t put any widgets in it, you are seeing this message.', 'themeblvd'), $sidebar['id']); break; case 'fixed': $message = sprintf(__('This is a fixed sidebar with ID, <strong>%s</strong>, but you haven\'t put any widgets in it yet.', 'themeblvd'), $sidebar['id']); break; } // Ouput message echo '<div class="alert warning">'; echo ' <p>' . $message . '</p>'; echo '</div><!-- .tb-warning (end) -->'; } } else { // Sidebar ID exists and there are no errors. // So, let's display the darn thing. dynamic_sidebar($sidebar['id']); } // End display echo '</div><!-- .widget_area (end) -->'; do_action('themeblvd_sidebar_' . $location . '_after'); // Framework does not hook anything here by default do_action('themeblvd_sidebar_' . $type . '_after'); // Framework does not hook anything here by default }
* Theme Blvd WordPress Framework. It is advised * that any edits to the way this file displays its * content be done with via hooks, filters, and * template parts. * * @author Jason Bobich * @copyright Copyright (c) Jason Bobich * @link http://jasonbobich.com * @link http://themeblvd.com * @package Theme Blvd WordPress Framework */ // End main area themeblvd_main_bottom(); themeblvd_main_end(); // Featured area (below) if (themeblvd_config('featured_below')) { themeblvd_featured_below_start(); themeblvd_featured_below(); themeblvd_featured_below_end(); } themeblvd_footer_before(); ?> <!-- FOOTER (start) --> <div id="bottom"> <footer id="colophon" role="contentinfo"> <div class="colophon-inner"> <?php /** * Display footer elements.
/** * Display headline. * * @since 2.0.0 * * @param array $args Options for headline * @return string $output HTML output for headline */ function themeblvd_headline($args = array()) { // Setup and extract $args $defaults = array('text' => '', 'tagline' => '', 'tag' => 'h1', 'align' => 'left'); $args = wp_parse_args($args, $defaults); extract($args, EXTR_OVERWRITE); // Swap in current page's title for %page_title% $text = str_replace('%page_title%', get_the_title(themeblvd_config('id')), $text); // Output $output = '<' . $tag . ' class="text-' . $align . '">'; $output .= stripslashes($text); $output .= '</' . $tag . '>'; if ($tagline) { $output .= '<p class="text-' . $align . '">'; $output .= stripslashes($tagline); $output .= '</p>'; } return $output; }
/** * The post thumbnail (must be within the loop) * * @since 2.0.0 * * @param string $location Where the thumbnail is being used -- primary, featured, single -- sort of a wild card to build on in the future as conflicts arise. * @param string $size For the image crop size of the thumbnail * @param bool $link Set to false to force a thumbnail to ignore post's Image Link options * @param bool $allow_filters Whether to allow general filters on the thumbnail or not * @return string $output HTML to output thumbnail */ function themeblvd_get_post_thumbnail($location = 'primary', $size = '', $link = true, $allow_filters = true) { global $post; $attachment_id = get_post_thumbnail_id($post->ID); $sidebar_layout = themeblvd_config('sidebar_layout'); $lightbox = false; $link_target = ''; $link_url = ''; $anchor_class = ''; $output = ''; $classes = ''; $image = ''; $title = ''; // If no thumbnail, we can skip everything. However, // we still want plugins to be able to filter in here // however they want. This same filter is applied below // on the final output. if (!has_post_thumbnail($post->ID) && $allow_filters) { return apply_filters('themeblvd_post_thumbnail', '', $location, $size, $link); } // Determine correct thumbnail size string, or if wasn't // passed in, get a fallback based on framework options. $size = themeblvd_get_thumbnail_size($size, $location, $sidebar_layout); // If $size was set to null, it means the post // thumb should be hidden. So, return nothing. if ($size === null) { return $output; } // Can we just skip the featured image? $thumb_link_meta = get_post_meta($post->ID, '_tb_thumb_link', true); // used below in determining featured image link if ($thumb_link_meta == 'inactive') { $link = false; } // How about skipping featured image link on the single post? if ($link && $location == 'single' && get_post_meta($post->ID, '_tb_thumb_link_single', true) == 'no') { $link = false; } // Determine link for featured image if ($link) { $possible_link_options = array('post', 'thumbnail', 'image', 'video', 'external'); if (in_array($thumb_link_meta, $possible_link_options)) { switch ($thumb_link_meta) { case 'post': $title = get_the_title(); $link_url = get_permalink($post->ID); break; case 'thumbnail': $title = get_the_title($attachment_id); $link_url = wp_get_attachment_url($attachment_id); $lightbox = true; break; case 'image': $title = get_the_title(); $link_url = get_post_meta($post->ID, '_tb_image_link', true); $lightbox = true; break; case 'video': $title = get_the_title($attachment_id); $link_url = get_post_meta($post->ID, '_tb_video_link', true); $lightbox = true; break; case 'external': $link_url = get_post_meta($post->ID, '_tb_external_link', true); $link_target = get_post_meta($post->ID, '_tb_external_link_target', true); if (!$link_target) { $link_target = '_blank'; } break; } } else { $link = false; } } // Attributes $size_class = $size; if ($size_class == 'tb_small') { $size_class = 'small'; } $classes = 'attachment-' . $size_class . ' wp-post-image'; if (!$link) { $classes .= ' thumbnail'; } else { $anchor_class = 'thumbnail'; if ($thumb_link_meta != 'thumbnail') { $anchor_class .= ' ' . $thumb_link_meta; } } // Initial image without link $image = get_the_post_thumbnail($post->ID, $size, array('class' => '')); // Wrap image in link if ($link) { if ($lightbox) { $args = apply_filters('themeblvd_featured_image_lightbox_args', array('item' => $image . themeblvd_get_image_overlay(), 'link' => $link_url, 'class' => $anchor_class, 'title' => $title), $post->ID, $attachment_id); $image = themeblvd_get_link_to_lightbox($args); } else { $image = sprintf('<a href="%s" target="%s" class="%s" title="%s">%s%s</a>', $link_url, $link_target, $anchor_class, $title, $image, themeblvd_get_image_overlay()); } } // Final HTML output $output .= '<div class="featured-image-wrapper ' . $classes . '">'; $output .= '<div class="featured-image">'; $output .= '<div class="featured-image-inner">'; $output .= $image; $output .= '</div><!-- .featured-image-inner (end) -->'; $output .= '</div><!-- .featured-image (end) -->'; $output .= '</div><!-- .featured-image-wrapper (end) -->'; // Apply filters if allowed if ($allow_filters) { $output = apply_filters('themeblvd_post_thumbnail', $output, $location, $size, $link, $image); } // Return final output return $output; }
/** * Forward password-protected pages using * page templates to page.php * * @since 2.2.1 * * @param string $template Current template file * @return string $template Current theme location of page.php */ function themeblvd_private_page($template) { // Only for password protected pages. if (!post_password_required()) { return $template; } // Custom Layouts if (themeblvd_config('builder')) { $template = locate_template('page.php'); } // Page Templates $page_templates = apply_filters('themeblvd_private_page_support', array('template_grid.php', 'template_list.php', 'template_archives.php', 'template_sitemap.php')); foreach ($page_templates as $page_template) { if (is_page_template($page_template)) { $template = locate_template('page.php'); } } // Removed hooked the_content on Post Grid/List templates if (is_page_template('template_list.php') || is_page_template('template_grid.php')) { remove_action('themeblvd_content_top', 'themeblvd_content_top_default'); } return $template; }
<?php /** * Display header elements. */ themeblvd_header_top(); themeblvd_header_above(); themeblvd_header_content(); themeblvd_header_menu(); ?> </div><!-- .content (end) --> </header><!-- #branding (end) --> </div><!-- #top (end) --> <!-- HEADER (end) --> <?php // After header themeblvd_header_after(); // Featured area (above) if (themeblvd_config('featured')) { themeblvd_featured_start(); themeblvd_featured(); themeblvd_featured_end(); } // Start main area themeblvd_main_start(); themeblvd_main_top(); // Breadcrumbs themeblvd_breadcrumbs(); // Before sidebar+content layout themeblvd_before_layout();
/** * Redirect to theme's Builder template. * * If the user selected a custom layout for the current * post, it means we caught it with our global config * filter in the previous function. Now, we just need * to check for that on single posts and then manually * forward to the custom layout page template. * * @since 1.0.0 */ function themeblvd_ltp_redirect($config) { // Include page template and exit if this is a // single post AND the global config says there // is a custom layout if (is_single() && themeblvd_config('builder')) { include_once locate_template('template_builder.php'); exit; } }
/** * Display builder elements below the primary area. * * @since 1.0.0 */ function themeblvd_builder_featured_below() { if (themeblvd_config('builder')) { themeblvd_builder_elements(themeblvd_config('builder_post_id'), 'featured_below'); } }
/** * Display fixed sidebar(s). Default display for action: themeblvd_sidebars * * @since 2.0.0 * * @param string $position position of sidebar on page, left or right */ function themeblvd_fixed_sidebars($position) { $layout = themeblvd_config('sidebar_layout'); // Sidebar Left, Sidebar Right, Double Sidebars if ($layout == 'sidebar_' . $position || $layout == 'double_sidebar') { do_action('themeblvd_fixed_sidebar_before', $position); themeblvd_display_sidebar('sidebar_' . $position); do_action('themeblvd_fixed_sidebar_after', $position); } // Double Left Sidebars if ($layout == 'double_sidebar_left' && $position == 'left') { // Left Sidebar do_action('themeblvd_fixed_sidebar_before', 'left'); themeblvd_display_sidebar('sidebar_left'); do_action('themeblvd_fixed_sidebar_after', 'left'); // Right Sidebar do_action('themeblvd_fixed_sidebar_before', 'right'); themeblvd_display_sidebar('sidebar_right'); do_action('themeblvd_fixed_sidebar_after', 'right'); } // Double Right Sidebars if ($layout == 'double_sidebar_right' && $position == 'right') { // Left Sidebar do_action('themeblvd_fixed_sidebar_before', 'left'); themeblvd_display_sidebar('sidebar_left'); do_action('themeblvd_fixed_sidebar_after', 'left'); // Right Sidebar do_action('themeblvd_fixed_sidebar_before', 'right'); themeblvd_display_sidebar('sidebar_right'); do_action('themeblvd_fixed_sidebar_after', 'right'); } }