/** * Post List * * @since 1.0.0 * * @param array $atts Standard WordPress shortcode attributes */ function themeblvd_shortcode_post_list($atts) { $default = array('categories' => '', 'cat' => '', 'category_name' => '', 'tag' => '', 'portfolio' => '', 'portfolio_tag' => '', 'thumbs' => 'default', 'post_content' => 'default', 'numberposts' => 3, 'orderby' => 'date', 'order' => 'DESC', 'offset' => 0, 'link' => 0, 'link_text' => 'View All Posts', 'link_url' => 'http://google.com', 'link_target' => '_self', 'query' => ''); extract(shortcode_atts($default, $atts)); // Build $options array compatible to element's function $options = array('thumbs' => $thumbs, 'content' => $post_content, 'tag' => $tag, 'portfolio' => $portfolio, 'portfolio_tag' => $portfolio_tag, 'numberposts' => $numberposts, 'orderby' => $orderby, 'order' => $order, 'offset' => $offset, 'query' => $query, 'link_text' => $link_text, 'link_url' => $link_url, 'link_target' => $link_target); // Categories if ($cat) { $options['cat'] = $cat; } elseif ($category_name) { $options['category_name'] = $category_name; } elseif ($categories) { $options['category_name'] = $categories; } // @deprecated // Add in the booleans if ($link === 'true') { $options['link'] = 1; } else { if ($link === 'false') { $options['link'] = 0; } else { $options['link'] = $default['link']; } } // Output ob_start(); echo '<div class="element element-post_list' . themeblvd_get_classes('element_post_list', true) . '">'; echo '<div class="element-inner">'; echo '<div class="element-inner-wrap">'; echo '<div class="grid-protection">'; themeblvd_posts($options, 'list', 'primary'); echo '</div><!-- .grid-protection (end) -->'; echo '</div><!-- .element-inner-wrap (end) -->'; echo '</div><!-- .element-inner (end) -->'; echo '</div><!-- .element (end) -->'; return ob_get_clean(); }
/** * Display custom layout within template_builder.php * page template. * * When each element is displayed, it is done so with * an external function. This will allow some elements * to be used for other things such as shortcodes. * However, even elements that shouldn't have an external * function do to allow those elements to be indidivually * edited from a child theme. * * @since 1.0.0 * * @param string $layout_id Post ID for custom layout * @param string $location Location of elements, featured or primary */ function themeblvd_builder_elements($layout_id, $location) { $api = Theme_Blvd_Builder_API::get_instance(); // Setup $counter = 0; $primary_query = false; if (!$layout_id) { // This should rarely happen. A common scenario might // be the user setup a page with a layout, but then // deleted the layout after page was already published. echo themeblvd_get_local('invalid_layout'); return; } // Gather elements and only move forward if we have elements to show. $elements = get_post_meta($layout_id, 'elements', true); if (!empty($elements) && !empty($elements[$location])) { $elements = $elements[$location]; $num_elements = count($elements); } else { // If there are no elements in this location, // get us out of here! return; } // Loop through elements foreach ($elements as $id => $element) { // Skip element if its type isn't registered if (!$api->is_element($element['type'])) { continue; } // Increase counter $counter++; // CSS classes for element $classes = 'element ' . $location . '-element-' . $counter . ' element-' . $element['type']; if ($counter == 1) { $classes .= ' first-element'; } if ($num_elements == $counter) { $classes .= ' last-element'; } if ($element['type'] == 'slider') { if (isset($element['options']['slider_id'])) { $slider_id = themeblvd_post_id_by_name($element['options']['slider_id'], 'tb_slider'); $type = get_post_meta($slider_id, 'type', true); $classes .= ' element-slider-' . $type; } } if ($element['type'] == 'paginated_post_lst' || $element['type'] == 'paginated_post_grid') { $classes .= $element['type']; } if (!empty($element['options']['classes'])) { $classes .= ' ' . $element['options']['classes']; } if (isset($element['options']['visibility'])) { $classes .= themeblvd_responsive_visibility_class($element['options']['visibility'], true); } $classes .= themeblvd_get_classes('element_' . $element['type'], true, false, $element['type'], $element['options'], $location); // Start ouput do_action('themeblvd_element_' . $element['type'] . '_before', $id, $element['options'], $location); // Before element: themeblvd_element_{type}_before do_action('themeblvd_element_open', $element['type'], $location, $classes); do_action('themeblvd_element_' . $element['type'] . '_top', $id, $element['options'], $location); // Top of element: themeblvd_element_{type}_top echo '<div class="grid-protection">'; switch ($element['type']) { /*------------------------------------------------------*/ /* Columns /*------------------------------------------------------*/ case 'columns': if (!function_exists('themeblvd_columns')) { _e('Columns element not supported.', 'themeblvd_builder'); break; } $i = 1; $columns = array(); $num = $element['options']['setup']['num']; while ($i <= $num) { $columns[] = $element['options']['col_' . $i]; $i++; } themeblvd_columns($num, $element['options']['setup']['width'][$num], $columns); break; /*------------------------------------------------------*/ /* Content /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Content /*------------------------------------------------------*/ case 'content': if (!function_exists('themeblvd_content')) { _e('Content element not supported.', 'themeblvd_builder'); break; } echo themeblvd_content($element['options']); break; /*------------------------------------------------------*/ /* Divider /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Divider /*------------------------------------------------------*/ case 'divider': if (!function_exists('themeblvd_divider')) { _e('Divider element not supported.', 'themeblvd_builder'); break; } echo themeblvd_divider($element['options']['type']); break; /*------------------------------------------------------*/ /* Headline /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Headline /*------------------------------------------------------*/ case 'headline': if (!function_exists('themeblvd_headline')) { _e('Headline element not supported.', 'themeblvd_builder'); break; } echo themeblvd_headline($element['options']); break; /*------------------------------------------------------*/ /* Jumbotron /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Jumbotron /*------------------------------------------------------*/ case 'jumbotron': if (!function_exists('themeblvd_jumbotron')) { _e('Jumbotron element not supported.', 'themeblvd_builder'); break; } themeblvd_jumbotron($element['options']); break; /*------------------------------------------------------*/ /* Post Grid /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Post Grid /*------------------------------------------------------*/ case 'post_grid': if (!function_exists('themeblvd_posts')) { _e('Post Grid element not supported.', 'themeblvd_builder'); break; } themeblvd_posts($element['options'], 'grid', $location, 'secondary'); break; /*------------------------------------------------------*/ /* Post Grid (paginated) /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Post Grid (paginated) /*------------------------------------------------------*/ case 'post_grid_paginated': if (!function_exists('themeblvd_posts_paginated')) { _e('Paginated Post Grid element not supported.', 'themeblvd_builder'); break; } if (!$primary_query) { themeblvd_posts_paginated($element['options'], 'grid', $location); $primary_query = true; } break; /*------------------------------------------------------*/ /* Post Grid Slider /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Post Grid Slider /*------------------------------------------------------*/ case 'post_grid_slider': if (!function_exists('themeblvd_post_slider')) { _e('Post Grid Slider element not supported.', 'themeblvd_builder'); break; } themeblvd_post_slider($id, $element['options'], 'grid', $location); break; /*------------------------------------------------------*/ /* Post List /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Post List /*------------------------------------------------------*/ case 'post_list': if (!function_exists('themeblvd_posts')) { _e('Post List element not supported.', 'themeblvd_builder'); break; } themeblvd_posts($element['options'], 'list', $location, 'secondary'); break; /*------------------------------------------------------*/ /* Post List (paginated) /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Post List (paginated) /*------------------------------------------------------*/ case 'post_list_paginated': if (!function_exists('themeblvd_posts_paginated')) { _e('Paginated Post List element not supported.', 'themeblvd_builder'); break; } if (!$primary_query) { themeblvd_posts_paginated($element['options'], 'list', $location); $primary_query = true; } break; /*------------------------------------------------------*/ /* Post List Slider /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Post List Slider /*------------------------------------------------------*/ case 'post_list_slider': if (!function_exists('themeblvd_post_slider')) { _e('Post List Slider element not supported.', 'themeblvd_builder'); break; } themeblvd_post_slider($id, $element['options'], 'list', $location); break; /*------------------------------------------------------*/ /* Post Slider (mimics standard slider) /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Post Slider (mimics standard slider) /*------------------------------------------------------*/ case 'post_slider': if (!function_exists('themeblvd_slider_auto')) { _e('Post Slider element not supported.', 'themeblvd_builder'); break; } themeblvd_slider_auto($id, $element['options']); break; /*------------------------------------------------------*/ /* Slider /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Slider /*------------------------------------------------------*/ case 'slider': if (!function_exists('themeblvd_slider')) { _e('Slider element not supported.', 'themeblvd_builder'); break; } themeblvd_slider($element['options']['slider_id']); break; /*------------------------------------------------------*/ /* Slogan /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Slogan /*------------------------------------------------------*/ case 'slogan': if (!function_exists('themeblvd_slogan')) { _e('Slogan element not supported.', 'themeblvd_builder'); break; } echo themeblvd_slogan($element['options']); break; /*------------------------------------------------------*/ /* Tabs /*------------------------------------------------------*/ /*------------------------------------------------------*/ /* Tabs /*------------------------------------------------------*/ case 'tabs': if (!function_exists('themeblvd_tabs')) { _e('Tabs element not supported.', 'themeblvd_builder'); break; } echo themeblvd_tabs($id, $element['options']); break; } // End switch // Allow to add on custom element that's // not in the framework do_action('themeblvd_' . $element['type'], $id, $element['options'], $location); // End output echo '<div class="clear"></div>'; echo '</div><!-- .grid-protection (end) -->'; do_action('themeblvd_element_' . $element['type'] . '_bottom', $id, $element['options'], $location); // Bottom of element: themeblvd_element_{type}_bottom do_action('themeblvd_element_close', $element['type'], $location, $classes); do_action('themeblvd_element_' . $element['type'] . '_after', $id, $element['options'], $location); // Below element: themeblvd_element_{type}_bottom } // End foreach }
get_sidebar('left'); ?> <!-- CONTENT (start) --> <div id="content" class="<?php echo themeblvd_get_column_class('content'); ?> clearfix" role="main"> <div class="inner"> <?php themeblvd_content_top(); ?> <div class="primary-post-list element-post_list_paginated post_list<?php echo themeblvd_get_classes('element_post_list_paginated', true); ?> "> <?php // Query the post list $post_list = new WP_Query(themeblvd_get_second_query()); // Start the loop if ($post_list->have_posts()) { while ($post_list->have_posts()) { $post_list->the_post(); global $more; $more = 0; // Get template part, framework default is content-list.php get_template_part('content', themeblvd_get_part('list_paginated')); } } else {
/** * Post slider shortcode - [post_slider] * * @since 1.0.2 * * @param array $atts Standard WordPress shortcode attributes */ function themeblvd_shortcode_slider_auto($atts) { if (!function_exists('themeblvd_slider_auto')) { return __('Your theme does not support the [post_slider] shortcode.', 'themeblvd_sliders'); } $default = array('fx' => 'slide', 'smoothheight' => 'true', 'timeout' => '3', 'nav_standard' => '1', 'nav_arrows' => '1', 'pause_play' => '1', 'pause_on_hover' => 'disable', 'image' => 'full', 'image_size' => 'slider-large', 'image_link' => 'permalink', 'button' => '', 'tag' => '', 'category' => '', 'portfolio' => '', 'portfolio_tag' => '', 'numberposts' => '5', 'orderby' => 'date', 'order' => 'DESC', 'query' => '', 'mobile_fallback' => 'full_list'); $atts = shortcode_atts($default, $atts); // Output ob_start(); echo '<div class="element element-slider element-slider-standard' . themeblvd_get_classes('element_post_slider', true) . '">'; echo '<div class="element-inner">'; echo '<div class="element-inner-wrap">'; echo '<div class="grid-protection">'; themeblvd_slider_auto(uniqid('post_slider_' . rand()), $atts); echo '</div><!-- .grid-protection (end) -->'; echo '</div><!-- .element-inner-wrap (end) -->'; echo '</div><!-- .element-inner (end) -->'; echo '</div><!-- .element (end) -->'; return ob_get_clean(); }