public function init() { // Add "more" text for excerpts //Bunyad::posts()->more_html = '<span class="read-more arrow"><a href="%s" title="%s">→</a></span>'; Bunyad::core()->add_body_class('skin-tech'); add_filter('bunyad_css_generator_cat', array($this, 'add_dynamic_css')); // Set listing meta position to below title in this skin Bunyad::options()->meta_position = 'below'; add_filter('bunyad_featured_image', array($this, 'adjust_specific_images'), 10, 3); }
/** * Initialize cache */ public function init() { // save defaults - also used by custom-css generator via Bunyad::options()->default $options_tree = (include get_template_directory() . '/admin/options.php'); $this->defaults = Bunyad::factory('admin/options')->get_elements_from_tree($options_tree); $options = get_option($this->configs['theme_prefix'] . '_theme_options'); if (is_array($options) && $options) { $this->cache = $options; } }
public function form($instance) { $defaults = array('type' => '', 'image' => '', 'text' => '', 'email' => '', 'posts' => ''); $instance = array_merge($defaults, (array) $instance); extract($instance); $render = Bunyad::factory('admin/option-renderer'); /* @var $render Bunyad_Admin_OptionRenderer */ ?> <input type="hidden" name="<?php echo $this->get_field_name('no_container'); ?> " value="1" /> <p><strong><?php _e('Important:', 'so-panels'); ?> </strong> <?php _e('This block automatically shows the sub-categories under a parent category. Only a parent category needs to be selected.', 'so-panels'); ?> </p> <p> <label><?php _e('Separator Type:', 'so-panels'); ?> </label> <select class="widefat" name="<?php echo esc_attr($this->get_field_name('type')); ?> "> <option value="line"><?php _e('Line', 'so-panels'); ?> </option> <option value="space"><?php _e('Space', 'so-panels'); ?> </option> <option value="half-line"><?php _e('Half Height Line', 'so-panels'); ?> </option> <option value="half-space"><?php _e('Half Height Space', 'so-panels'); ?> </option> </select> </p> <?php }
/** * Get a unique id to be used mainly in blocks * * WARNING: Not persistent - will change with request order. * * @param string $prefix a prefix for internal distinction and for output unless disabled * @param boolean $return_id_only return id without prefix */ public function unique_id($prefix = '', $return_id_only = false) { // get item from registry $ids = (array) Bunyad::registry()->bunyad_markup_ids; $key = $prefix ? $prefix : 'default'; if (!isset($ids[$key])) { $ids[$key] = 0; } $ids[$key]++; // update registry Bunyad::registry()->set('bunyad_markup_ids', $ids); return ($return_id_only ? '' : $prefix) . $ids[$key]; }
/** * Action callback: Save custom meta for categories */ public function save_category_meta($term_id) { // have custom meta? if (!empty($_POST['meta']) && is_array($_POST['meta'])) { $meta = $_POST['meta']; // editing? if ($option = Bunyad::options()->get('cat_meta_' . $term_id)) { $meta = array_merge($option, $_POST['meta']); } Bunyad::options()->update('cat_meta_' . $term_id, $meta); // clear custom css cache delete_transient('bunyad_custom_css_cache'); } }
/** * Render the metabox - used via callback * * @param array $post * @param array $args */ public function render($post = null, $args = null) { if (!$args['id']) { return false; } // add nonce for security if (!isset($this->cache['nonce'])) { wp_nonce_field('meta_save', '_nonce_' . $this->prefix . 'meta', false); } Bunyad::factory('admin/option-renderer'); // load $file = sanitize_file_name(str_replace($this->prefix, '', $args['id'])) . '.php'; $meta = Bunyad::factory('admin/meta-renderer', true); /* @var $meta Bunyad_Admin_MetaRenderer */ // render the template $meta->set_prefix($this->option_prefix)->template(array(), locate_template('admin/meta/' . $file), Bunyad::posts()->meta(null, $post->ID), array('post' => $post, 'box' => $this->get_box($args['id']), 'box_id' => $args['id'])); }
/** * Filter callback: Add a search icon the navigation */ public function add_navigation_search($items, $args) { return $items; if (!Bunyad::options()->nav_search or $args->theme_location != 'main') { return $items; } ob_start(); // nav search flag used by search.php $in_nav = true; ?> <li class="search-icon"> <a href="#" title="<?php esc_attr_e('Search', 'bunyad'); ?> "><i class="fa fa-search"></i></a> <?php include locate_template('partials/header/search.php'); ?> </li> <?php $items .= ob_get_clean(); return $items; }
public function get_custom_fields($item, $depth = 0) { $fields = apply_filters('bunyad_custom_menu_fields', array()); $output = ''; foreach ($fields as $key => $field) { // parent menu field only? if (!empty($field['parent_only']) && $depth > 0) { continue; } // only applies to a specific location? if (!empty($field['locations']) && !empty($this->locations[$this->current_menu]) && !in_array($this->locations[$this->current_menu], $field['locations'])) { continue; } // relevant field values $name = 'menu-item-' . esc_attr($key) . '[' . $item->ID . ']'; $value = esc_attr($item->{$key}); // use renderer or a template? if (is_array($field['element'])) { $renderer = Bunyad::factory('admin/option-renderer'); /* @var $renderer Bunyad_Admin_OptionRenderer */ if ($field['element']['type'] == 'select') { $template = $renderer->render_select(array_merge(array('name' => $name, 'value' => $value), $field['element'])); } } else { // string template $template = str_replace(array('%id%', '%name%', '%value%'), array($item->ID, $name, $value), $field['element']); } $output .= ' <p class="field-custom description description-wide"> <label for="edit-menu-item-subtitle-' . esc_attr($item->ID) . '"> ' . $field['label'] . '<br />' . $template . ' </label> </p>'; } return $output; }
<?php echo Bunyad::blocks()->meta('above', 'related-posts', array('type' => 'widget')); ?> <h2><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a></h2> <?php echo Bunyad::blocks()->meta('below', 'related-posts', array('type' => 'widget')); ?> </article> </li> <?php } wp_reset_postdata(); ?> </ul> </section> <?php }
public function widget($args, $instance) { global $post; // setup_postdata not enough // set defaults $titles = $cats = $tax_tags = array(); extract($args); extract($instance); // missing data? if (!count($titles) or !count($cats)) { _e('Recent tabs widget still need to be configured! Add tabs, add a title, and select type for each tab in widgets area.', 'bunyad-widgets'); return; } $tabs = array(); foreach ($titles as $key => $title) { // defaults missing? if (empty($tax_tags[$key])) { $tax_tags[$key] = ''; } if (empty($cats[$key])) { $cats[$key] = ''; } if (empty($posts[$key])) { $posts[$key] = !empty($number) ? $number : 0; } $tabs[$title] = array('cat_type' => $cats[$key], 'tag' => $tax_tags[$key], 'posts' => $posts[$key]); } // latest posts $posts = $this->get_posts($tabs); // do custom loop if available if (has_action('bunyad_widget_tabbed_recent_loop')) { $args['tabs'] = $tabs; do_action('bunyad_widget_tabbed_recent_loop', $args, $posts); } else { ?> <?php echo $before_widget; ?> <ul class="tabs-list"> <?php $count = 0; foreach ($posts as $key => $val) { $count++; $active = $count == 1 ? 'active' : ''; ?> <li class="<?php echo $active; ?> "> <a href="#" data-tab="<?php echo esc_attr($count); ?> "><?php echo $key; ?> </a> </li> <?php } ?> </ul> <div class="tabs-data"> <?php $i = 0; foreach ($posts as $tab => $tab_posts) { $i++; $active = $i == 1 ? 'active' : ''; ?> <ul class="tab-posts <?php echo $active; ?> posts-list" id="recent-tab-<?php echo esc_attr($i); ?> "> <?php if ($tabs[$tab] == 'comments') { ?> <?php foreach ($tab_posts as $comment) { ?> <li class="comment"> <span class="author"><?php printf('%s said', get_comment_author_link($comment->comment_ID)); ?> </span> <p class="text"><?php comment_excerpt($comment->comment_ID); ?> </p> <a href=""><?php echo get_the_title($comment->comment_post_ID); ?> </a> </li> <?php } ?> <?php } else { ?> <?php while ($tab_posts->have_posts()) { $tab_posts->the_post(); ?> <li> <a href="<?php the_permalink(); ?> "><?php the_post_thumbnail('post-thumbnail', array('title' => strip_tags(get_the_title()))); ?> <?php if (class_exists('Bunyad') && Bunyad::options()->review_show_widgets) { ?> <?php echo apply_filters('bunyad_review_main_snippet', ''); ?> <?php } ?> </a> <div class="content"> <?php echo Bunyad::blocks()->meta('above', 'tabbed-recent', array('type' => 'widget')); ?> <a href="<?php the_permalink(); ?> " title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?> "> <?php if (get_the_title()) { the_title(); } else { the_ID(); } ?> </a> <?php echo Bunyad::blocks()->meta('below', 'tabbed-recent', array('type' => 'widget')); ?> <?php if (class_exists('Bunyad') && Bunyad::options()->review_show_widgets) { ?> <?php echo apply_filters('bunyad_review_main_snippet', '', 'stars'); ?> <?php } ?> </div> </li> <?php } ?> <?php } ?> </ul> <?php } ?> </div> <?php echo $after_widget; ?> <?php } // end custom loop wp_reset_postdata(); wp_reset_query(); }
<?php /** * Get the selected header template * * Note: Default is partials/header/layout.php */ get_template_part('partials/header/layout', Bunyad::options()->header_style); ?> <?php if (!Bunyad::options()->disable_breadcrumbs) { ?> <div <?php Bunyad::markup()->attribs('breadcrumbs-wrap', array('class' => array('breadcrumbs-wrap'))); ?> > <div class="wrap"> <?php Bunyad::core()->breadcrumbs(); ?> </div> </div> <?php } ?> <?php do_action('bunyad_pre_main_content');
<?php // sidebar HTML attributes $attribs = array('class' => 'col-4 sidebar'); if (Bunyad::options()->sticky_sidebar) { $attribs['data-sticky'] = 1; } do_action('bunyad_sidebar_start'); ?> <aside <?php Bunyad::markup()->attribs('sidebar', $attribs); ?> > <ul> <?php if (!dynamic_sidebar('primary-sidebar')) { ?> <?php _e("<li>Nothing yet.</li>", 'bunyad'); ?> <?php } ?> </ul> </aside>
public function form($instance) { $defaults = array('pagination' => 0, 'heading' => '', 'heading_type' => '', 'posts' => 4, 'type' => '', 'cats' => '', 'post_type' => ''); $instance = array_merge($defaults, (array) $instance); extract($instance); $render = Bunyad::factory('admin/option-renderer'); /* @var $render Bunyad_Admin_OptionRenderer */ ?> <input type="hidden" name="<?php echo $this->get_field_name('no_container'); ?> " value="1" /> <p> <label><?php _e('Number of Posts:', 'bunyad-admin'); ?> </label> <input name="<?php echo esc_attr($this->get_field_name('posts')); ?> " type="text" value="<?php echo esc_attr($posts); ?> " /> </p> <p class="description"><?php _e('Configures posts to show for each listing. Leave empty to use theme default number of posts.', 'bunyad-admin'); ?> </p> <p> <label><?php _e('Sort By:', 'bunyad-admin'); ?> </label> <select name="<?php echo esc_attr($this->get_field_name('sort_by')); ?> "> <option value=""><?php _e('Published Date', 'bunyad-admin'); ?> </option> <option value="modified"><?php _e('Modified Date', 'bunyad-admin'); ?> </option> <option value="random"><?php _e('Random', 'bunyad-admin'); ?> </option> </select> <select name="<?php echo esc_attr($this->get_field_name('sort_order')); ?> "> <option value="desc"><?php _e('Latest First - Descending', 'bunyad-admin'); ?> </option> <option value="asc"><?php _e('Oldest First - Ascending', 'bunyad-admin'); ?> </option> </select> </p> <p> <label><?php _e('Listing Style:', 'bunyad-admin'); ?> </label> <select class="widefat" name="<?php echo esc_attr($this->get_field_name('type')); ?> "> <option value=""><?php _e('Default Style (In Theme Settings)', 'bunyad-admin'); ?> </option> <option value="modern"><?php _e('Modern Style - 2 Column', 'bunyad-admin'); ?> </option> <option value="modern-3"><?php _e('Modern Style - 3 Column', 'bunyad-admin'); ?> </option> <option value="grid-overlay"><?php _e('Grid Overlay - 2 Column', 'bunyad-admin'); ?> </option> <option value="grid-overlay-3"><?php _e('Grid Overlay - 3 Column', 'bunyad-admin'); ?> </option> <option value="tall-overlay"><?php _e('Tall Grid Overlay', 'bunyad-admin'); ?> </option> <option value="alt"><?php _e('Blog Style', 'bunyad-admin'); ?> </option> <option value="classic"><?php _e('Classic - Large Blog Style', 'bunyad-admin'); ?> </option> <option value="timeline"><?php _e('Timeline Style', 'bunyad-admin'); ?> </option> </select> </p> <p class="description"><?php _e('Check docs and demo to choose the right style.', 'bunyad-admin'); ?> </p> <p> <label><?php _e('Main Category: (Optional)', 'bunyad-admin'); ?> </label> <?php wp_dropdown_categories(array('show_option_all' => __('-- None --', 'bunyad-admin'), 'hierarchical' => 1, 'hide_empty' => 0, 'order_by' => 'name', 'class' => 'widefat', 'name' => $this->get_field_name('cat'))); ?> </p> <p class="description"><?php _e('Posts will be limited to this category and category color will be used for heading.', 'bunyad-admin'); ?> </p> <p> <label><?php _e('Heading: (Optional)', 'bunyad-admin'); ?> </label> <input class="widefat" name="<?php echo esc_attr($this->get_field_name('heading')); ?> " type="text" value="<?php echo esc_attr($heading); ?> " /> </p> <p class="description"><?php _e('Optional heading.', 'bunyad-admin'); ?> </p> <p> <label><?php _e('Heading Style:', 'bunyad-admin'); ?> </label> <select class="widefat" name="<?php echo esc_attr($this->get_field_name('heading_type')); ?> "> <option value="block"><?php _e('Block Section Heading Style', 'bunyad-admin'); ?> </option> <option value=""><?php _e('Page Heading Style', 'bunyad-admin'); ?> </option> </select> </p> <p class="description"><?php _e('Page heading style is normal heading style used for pages. Block section heading style is what you would see often on homepage with multiple sections.', 'bunyad-admin'); ?> </p> <p> <label><?php _e('Show Category Overlays?', 'bunyad-admin'); ?> </label> <select class="widefat" name="<?php echo esc_attr($this->get_field_name('cat_labels')); ?> "> <option value="1"><?php _e('Yes', 'bunyad-admin'); ?> </option> <option value="0"><?php _e('No', 'bunyad-admin'); ?> </option> </select> </p> <div> <label><?php _e('Pagination:', 'bunyad-admin'); ?> </label> <select class="widefat" name="<?php echo esc_attr($this->get_field_name('pagination')); ?> "> <option value="0"><?php _e('Disabled', 'bunyad-admin'); ?> </option> <option value="1"><?php _e('Enabled', 'bunyad-admin'); ?> </option> </select> </div> <div> <label><?php _e('Pagination Type:', 'bunyad-admin'); ?> </label> <select class="widefat" name="<?php echo esc_attr($this->get_field_name('pagination_type')); ?> "> <option value=""><?php _e('Normal', 'bunyad-admin'); ?> </option> <option value="infinite"><?php _e('Infinite Scroll', 'bunyad-admin'); ?> </option> </select> </div> <p class="description"><?php _e('WARNING: Infinite Scroll will only work for the last block on a page. Infinite scroll loads more posts as user scrolls.', 'bunyad-admin'); ?> </p> <div class="taxonomydiv"> <!-- borrow wp taxonomydiv > categorychecklist css rules --> <label><?php _e('Limit Categories:', 'bunyad-admin'); ?> </label> <div class="tabs-panel"> <ul class="categorychecklist"> <?php ob_start(); wp_category_checklist(); echo str_replace('post_category[]', $this->get_field_name('cats') . '[]', ob_get_clean()); ?> </ul> </div> </div> <p class="description"><?php _e('By default, all categories will be used. Tick categories to limit to a specific category or categories.', 'bunyad-admin'); ?> </p> <p class="tag"> <?php _e('or Limit with Tags: (optional)', 'bunyad-admin'); ?> <input type="text" name="<?php echo $this->get_field_name('tags'); ?> " value="" class="widefat" /> </p> <p class="description"><?php _e('Separate tags with comma. e.g. cooking,sports', 'bunyad-admin'); ?> </p> <p> <label><?php _e('Offset: (Advanced)', 'bunyad-admin'); ?> </label> <input type="text" name="<?php echo $this->get_field_name('offset'); ?> " value="0" /> </p> <p class="description"><?php _e('By specifying an offset as 10 (for example), you can ignore 10 posts in the results.', 'bunyad-admin'); ?> </p> <p> <label><?php _e('Post Types: (Advanced)', 'bunyad-admin'); ?> </label> <input name="<?php echo esc_attr($this->get_field_name('post_type')); ?> " type="text" value="<?php echo esc_attr($post_type); ?> " /> </p> <p class="description"><?php _e('Only for advanced users! You can use a custom post type here - multiples supported when separated by comma. Leave empty to use the default format.', 'bunyad-admin'); ?> </p> <?php }
<?php /** * Pagination - Show numbered pagination for catalog pages. * * @version 2.2.2 */ ?> <div class="main-pagination"> <?php echo Bunyad::posts()->paginate(); ?> </div>
<div class="gallery-slider slider-arrows"> <div class="frame flexslider"> <ul class="slides"> <?php foreach ($images as $attachment) { ?> <li> <a href="<?php echo wp_get_attachment_url($attachment->ID); ?> "> <?php if (!in_the_loop() && Bunyad::posts()->meta('layout_style') == 'full' or Bunyad::core()->get_sidebar() == 'none') { // largest images - no sidebar? ?> <?php echo wp_get_attachment_image($attachment->ID, 'main-full'); ?> <?php } else { ?> <?php echo wp_get_attachment_image($attachment->ID, 'main-slider'); ?>
/** * Product listing columns in WooCommerce */ public function columns() { return Bunyad::core()->get_sidebar() == 'none' ? 4 : 3; }
"> <?php if (get_the_title()) { the_title(); } else { the_ID(); } ?> </a> <?php echo Bunyad::blocks()->meta('below', 'live-search', array('type' => 'widget')); ?> <?php if (class_exists('Bunyad') && Bunyad::options()->review_show_widgets) { ?> <?php echo apply_filters('bunyad_review_main_snippet', '', 'stars'); ?> <?php } ?> </div> </li> <?php }
update_option('show_on_front', 'page'); update_option('page_on_front', $home->ID); } } } /** * Action callback: Fix menu on sample import * * @param object $import */ public function import_fix_menu($import) { // remove an item from menu $item = get_page_by_title('Shop With Sidebar', OBJECT, 'nav_menu_item'); if (is_object($item)) { wp_delete_post($item->ID); } } /** * Custom Menu fields for the sample menu * * @param array $values */ public function import_menu_fields($values = array()) { return array('mega_menu' => array('Entertainment' => 'category', 'Tidbits' => 'category', 'Features' => 'normal'), 'url' => array('Forums' => home_url('/forums/'))); } } // init and make available in Bunyad::get('admin_import') Bunyad::register('admin_import', array('class' => 'Bunyad_Theme_Admin_Import', 'init' => true));
?> <img src="<?php echo esc_attr(Bunyad::options()->image_logo_mobile); ?> " class="logo-mobile" width="0" height="0" /> <?php } ?> <img src="<?php echo esc_attr(Bunyad::options()->image_logo); ?> " class="logo-image" alt="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> " <?php echo Bunyad::options()->image_logo_retina ? 'data-at2x="' . esc_attr(Bunyad::options()->image_logo_retina) . '"' : ''; ?> /> <?php } else { ?> <?php echo do_shortcode(Bunyad::options()->text_logo); ?> <?php } ?> </a>
?> " title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?> "> <?php if (get_the_title()) { the_title(); } else { the_ID(); } ?> </a> <?php echo Bunyad::blocks()->meta('below', 'block-small'); ?> <?php echo apply_filters('bunyad_review_main_snippet', '', 'stars'); ?> </div> <?php } else { ?> <i class="fa fa-angle-right"></i> <a href="<?php the_permalink();
</div> <?php } ?> </header> <?php if (!Bunyad::options()->nav_layout) { // normal width navigation? ?> <?php get_template_part('partials/header/nav'); ?> <?php } ?> </div> <?php // Full width navigation goes out of wrap container if (Bunyad::options()->nav_layout == 'nav-full') { get_template_part('partials/header/nav'); } ?> </div>
</div> <span class="hover-number"></span> <?php } else { ?> <span class="rating"><?php echo esc_html(Bunyad::reviews()->get_user_rating(null, $type)) . ($type == 'percent' ? ' %' : ''); ?> </span> <span class="hover-number"></span> <div class="rating-bar"><span class="bar" style="width: <?php echo Bunyad::reviews()->get_user_rating(null, 'percent'); ?> %;"></span></div> <?php } ?> </li> <?php } ?> </ul> </section>
<?php $render = Bunyad::factory('admin/option-renderer'); ?> <p><a href="#" id="add-more-groups"><?php _e('Add More Accordions', 'bunyad-shortcodes'); ?> </a></p> <script type="text/html" class="template-group-options"> <div class="divider-or"><span><?php _e('Accordion %number%'); ?> </span></div> <div class="element-control"> <label><?php _e('Title:', 'bunyad-shortcodes'); ?> </label> <?php echo $render->render_text(array('name' => 'title[%number%]')); ?> </div> <div class="element-control"> <label><?php _e('Default:', 'bunyad-shortcodes'); ?>
if (!empty($panels) && !empty($panels['grids']) && is_singular() && !is_front_page()) { ?> <?php Bunyad::posts()->the_content(); ?> <?php } else { ?> <div class="post-container cf"> <div class="post-content-right"> <div class="post-content description <?php echo Bunyad::posts()->meta('content_slider') ? 'post-slideshow' : ''; ?> " itemprop="articleBody"> <?php // get post body content get_template_part('partials/single/post-content'); ?> </div><!-- .post-content --> </div> </div> <?php }
/** * Categories can have custom colors, backgrounds, and so on. */ public function category_css() { $cat_css = <<<EOF .cat-%key%, .cat-title.cat-%key% { background: %color%; } .cat-text-%key%, .section-head.cat-text-%key% { color: %color%; } .navigation .menu > .menu-cat-%key%:hover > a, .navigation .menu > .menu-cat-%key%.current-menu-item > a, .navigation .menu > .menu-cat-%key%.current-menu-parent > a { \tborder-bottom-color: %color%; } EOF; if (Bunyad::options()->nav_style == 'nav-light') { $cat_css .= <<<EOF \t .nav-light .menu > .menu-cat-%key%:hover > a, .nav-light .menu > .menu-cat-%key%.current-menu-item > a, .nav-light .menu > .menu-cat-%key%.current-menu-parent > a { \tcolor: %color%; } \t\t EOF; } $cat_css = apply_filters('bunyad_css_generator_cat', $cat_css); $anchors = array(); if (!empty($this->args['anchor_obj'])) { $anchors = explode(',', $this->args['anchor_obj']); } foreach ((array) Bunyad::options()->get_all('cat_meta_') as $key => $cat) { $key = intval(substr($key, strrpos($key, '_') + 1)); // change main site color? if (!empty($cat['main_color']) && in_array($key, $anchors)) { // TODO: refactor with top parser $rules = $this->elements['css_main_color']['css']['selectors']; foreach ($rules as $css_key => $format) { // ignore media querie selectors if responsive is disabled if (Bunyad::options()->no_responsive && strstr($css_key, '@media')) { continue; } // create the selector $the_css = str_replace("\t", '', $css_key) . ' { ' . $this->create_rules($format, $cat['main_color']); // close media queries if (strstr($css_key, '@media')) { $the_css .= ' }'; } $this->css[] = $the_css . " }"; } } if (!empty($cat['color'])) { $this->css[] = str_replace(array('%key%', '%color%'), array($key, esc_attr($cat['color'])), $cat_css); } // background image? if (!empty($cat['bg_image'])) { $this->css[] = 'body.boxed.category-' . esc_attr($key) . ' { background: url(' . esc_attr($cat['bg_image']) . ') no-repeat center center fixed; ' . '-webkit-background-size: cover; -moz-background-size: cover;-o-background-size: cover; background-size: cover; }'; } } }
<?php } ?> </div> <?php if (!Bunyad::options()->blog_no_pagination) { // pagination can be disabled ?> <div class="main-pagination"> <?php echo Bunyad::posts()->paginate(array(), $bunyad_loop); ?> </div> <?php } ?> <?php } elseif (is_archive() or is_search()) { // show error on archive only ?> <article id="post-0" class="page no-results not-found"> <div class="post-content">
</article> <?php // add next/previous get_template_part('partials/single/post-navigation'); // add author box get_template_part('partials/single/author-box'); // add related posts get_template_part('partials/single/related-posts'); ?> <div class="comments"> <?php comments_template('', true); ?> </div> </div> <?php Bunyad::core()->theme_sidebar(); ?> </div> <!-- .row --> </div> <!-- .post-wrap --> <?php } // end of "the loop"
// add main cat if (!empty($cat)) { $cats = $cat . ',' . $cats; } // or limiting via cats or tags if (!empty($cats)) { $vars['cat'] = $cats; } if (!empty($tags)) { $vars['tag'] = $tags; } } // sorting if ($sort_by == 'modified') { $vars['orderby'] = 'modified'; } else { if ($sort_by == 'random') { $vars['orderby'] = 'rand'; } } // main loop $bunyad_loop = new WP_Query(apply_filters('bunyad_block_query_args', $vars, 'blog', $atts)); // get our loop template with include to preserve local variable scope include locate_template(sanitize_file_name($template . '.php')); // enqueue the js to footer if (Bunyad::options()->pagination_type == 'infinite') { wp_enqueue_script('smartmag-infinite-scroll'); } // restore all options Bunyad::options()->set_all($options); wp_reset_query();
dynamic_sidebar('main-footer'); ?> </ul> <?php } ?> </div> <?php } ?> <?php if (!Bunyad::options()->disable_lower_footer) { ?> <div class="lower-foot"> <div class="wrap"> <?php if (is_active_sidebar('lower-footer')) { ?> <div class="widgets"> <?php dynamic_sidebar('lower-footer'); ?> </div> <?php
/** * Get primary category of the current post in loop (if selected) * * Note: If no primary category is selected, it will return one category * using the default alphabetical sorting of WordPress. * * @see get_the_category() * @return object */ public function get_primary_cat() { // Custom label selected? if ($cat_label = Bunyad::posts()->meta('cat_label')) { $cat = get_category($cat_label); } else { $cat = current(get_the_category()); } return apply_filters('bunyad_get_primary_cat', $cat); }