public function setup()
 {
     // bunyad framework available? optional but good extras
     if (class_exists('Bunyad')) {
         Bunyad::options()->set('shortcodes', $this);
     } else {
         // bunyad framework themes implement it in main css for both speed and maintainability
         wp_enqueue_style('bunyad-shortcodes', plugin_dir_url(__FILE__) . 'css/shortcodes.css');
         // include framework dependencies
         require_once plugin_dir_path(__FILE__) . '/lib/bunyad.php';
     }
     // add extra shortcodes that can be enabled or disabled
     $latest_gallery = locate_template('blocks/latest-gallery.php');
     $this->add_blocks(apply_filters('bunyad_shortcode_default_blocks', array('latest_gallery' => array('render' => !empty($latest_gallery) ? $latest_gallery : 'latest-gallery', 'attribs' => array('format' => 'gallery', 'number' => 5, 'title' => '', 'cat' => '', 'type' => '', 'tax_tag' => '', 'offset' => '', 'post_type' => '')))));
     /*
      * Admin area?
      */
     if (is_admin()) {
         require_once plugin_dir_path(__FILE__) . 'admin.php';
         $sc = new Bunyad_Admin_ShortCodes();
     }
     // add cleanup
     add_filter('the_content', array($this, 'cleanup'));
     add_filter('shortcode_cleanup', array($this, 'cleanup'));
     // init / register shortcodes
     add_action('init', array($this, 'register_all'), 50);
     // i18n
     load_plugin_textdomain('bunyad-shortcodes', false, basename(dirname(__FILE__)) . '/languages');
 }
 public function get_box($box_id)
 {
     $meta = (array) Bunyad::options()->get_config('meta_boxes');
     foreach ($meta as $box) {
         if ($this->prefix . $box['id'] == $box_id) {
             return $box;
         }
     }
     return array();
 }
 public function init()
 {
     // Add "more" text for excerpts
     //Bunyad::posts()->more_html = '<span class="read-more arrow"><a href="%s" title="%s">&rarr;</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);
 }
 /**
  * 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');
     }
 }
    /**
     * 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;
    }
 /**
  * Set a default or selected sidebar for WooCommerce pages and archives
  */
 public function set_sidebar()
 {
     if (!(is_woocommerce() || is_checkout() || is_cart() || is_account_page())) {
         return;
     }
     $layout = '';
     // archives and single
     if (is_woocommerce() && !is_product()) {
         $layout = Bunyad::posts()->meta('layout_style', wc_get_page_id('shop'));
     }
     // checkout, cart, account and single product pages (not enabled atm)
     if (is_checkout() || is_cart() || is_account_page() || is_product()) {
         // set layout
         $layout = Bunyad::posts()->meta('layout_style');
     }
     // have a layout setting?
     if ($layout) {
         Bunyad::core()->set_sidebar($layout == 'full' ? 'none' : $layout);
     } else {
         // use default sidebar setting for WooCommerce
         Bunyad::core()->set_sidebar(Bunyad::options()->woocommerce_sidebar);
     }
 }
    /**
     * Get meta output for the block.
     * 
     * @param  string  $position  'above' or 'below - will match against theme settings.
     * @param  string  $name      Block name that will also be used as $args['type'] to determine
     *                            pre-defined settings.
     * @param  array   $args      Override default settings of the method.
     * 
     * @uses Bunyad::options()
     * @return string
     */
    public function meta($position = 'above', $name = '', $args = array())
    {
        if (Bunyad::options()->meta_position != $position) {
            return '';
        }
        /**
         * Default meta settings 
         */
        $defaults = array('type' => null, 'review' => 1, 'items' => '', 'class' => 'listing-meta meta');
        // Pre-defined special settings for few listing types
        $types = array('grid-overlay' => array('review' => 0, 'items' => Bunyad::options()->meta_listing_overlay), 'listing-alt' => array('review' => 0), 'widget' => array('review' => 0, 'items' => Bunyad::options()->meta_listing_widgets), 'block-small' => array('review' => 0, 'items' => array('date' => 1), 'class' => 'listing-meta'));
        // Check if args contain the type or fallback to name
        $type = !empty($args['type']) ? $args['type'] : $name;
        // Use special settings if type is specified
        if (!empty($types[$type])) {
            $defaults = array_merge($defaults, $types[$type]);
        }
        // Override args as needed
        $args = wp_parse_args($args, $defaults);
        /**
         * Apply a filter hook the final overriden args.
         * 
         * This hook can be used to change the block meta configuration for a specific
         * or all types of blocks.
         * 
         * @param array  $args
         * @param string $position
         * @param string $type
         */
        $args = apply_filters('bunyad_blocks_meta_args', $args, $position, $type);
        // Configuration from theme settings
        $meta_items = !$args['items'] ? Bunyad::options()->meta_listing : $args['items'];
        // Add review bar to the output?
        if ($args['review']) {
            // Add review at 2nd last position
            $offset = count($meta_items);
            $meta_items = array_merge(array_slice($meta_items, 0, $offset - 1), array('review' => 1), array_slice($meta_items, -2));
        }
        /**
         * Prepare meta to output based on the settings
         */
        $meta = array();
        foreach ($meta_items as $key => $show) {
            if (empty($show)) {
                continue;
            }
            switch ($key) {
                // Add date to the meta output
                case 'date':
                    $meta[] = '<time datetime="' . esc_attr(get_the_date(DATE_W3C)) . '" itemprop="datePublished" class="meta-item">' . get_the_date() . '</time>';
                    break;
                    // Append author name and link
                // Append author name and link
                case 'author':
                    global $authordata;
                    $author_link = sprintf('<a href="%1$s" title="%2$s" rel="author">%3$s</a>', esc_url(get_author_posts_url($authordata->ID, $authordata->user_nicename)), esc_attr(sprintf(__('Posts by %s', 'bunyad'), get_the_author())), get_the_author());
                    $meta[] = '<span class="meta-item author">' . _x('By', 'Post Meta', 'bunyad') . ' ' . $author_link . '</span>';
                    break;
                case 'review':
                    $meta[] = apply_filters('bunyad_review_main_snippet', '');
                    break;
                    // Add comment count with the icon
                // Add comment count with the icon
                case 'comments':
                    $meta[] = '<span class="meta-item comments"><a href="' . esc_url(get_comments_link()) . '"><i class="fa fa-comments-o"></i> ' . get_comments_number() . '</a></span>';
                    break;
            }
        }
        $meta = implode('', $meta);
        $args['class'] .= ' ' . $position;
        ob_start();
        if (!empty($meta)) {
            ?>
			<div class="cf <?php 
            echo esc_attr($args['class']);
            ?>
">
					
				<?php 
            echo $meta;
            ?>
					
			</div>
		<?php 
        }
        return apply_filters('bunyad_blocks_meta', ob_get_clean());
    }
    // 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();
        ?>
					
				</div>
			
			</article>
		</div>
			
		<?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 
        if (is_single()) {
            $url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $url = $url[0];
        }
        ?>
			
				<a href="<?php 
        echo $url;
        ?>
" title="<?php 
        the_title_attribute();
        ?>
" itemprop="image">
				
				<?php 
        if (Bunyad::options()->blog_thumb != 'thumb-left') {
            // normal container width image
            ?>
				
					<?php 
            if (!in_the_loop() && Bunyad::posts()->meta('layout_style') == 'full' or Bunyad::core()->get_sidebar() == 'none') {
                // largest images - no sidebar?
                ?>
				
						<?php 
                the_post_thumbnail('main-full', array('title' => strip_tags(get_the_title())));
                ?>
				
					<?php 
            } else {
                ?>
if (Bunyad::posts()->meta('content_slider')) {
    get_template_part('partials/pagination-next');
}
?>
		
		<?php 
// excerpts or main content?
if (!is_page() && is_singular() or !Bunyad::options()->show_excerpts_classic or Bunyad::posts()->meta('content_slider')) {
    Bunyad::posts()->the_content();
} else {
    echo Bunyad::posts()->excerpt(null, Bunyad::options()->excerpt_length_classic, array('force_more' => true));
}
?>

		
		<?php 
// multi-page post - add numbered pagination
if (!Bunyad::posts()->meta('content_slider')) {
    wp_link_pages(array('before' => '<div class="main-pagination post-pagination">', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>'));
}
?>
		
		<?php 
if (is_single() && Bunyad::options()->show_tags) {
    ?>
			<div class="tagcloud"><?php 
    the_tags('', ' ');
    ?>
</div>
		<?php 
}
					</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>
Exemplo n.º 13
0
        ?>
					<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>
    public function widget($args, $instance)
    {
        $cache = get_transient('bunyad_widget_latest_reviews');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->number;
        }
        // cache available
        if (isset($cache[$args['widget_id']])) {
            //echo $cache[ $args['widget_id'] ];
            //return;
        }
        ob_start();
        extract($args);
        extract($instance, EXTR_SKIP);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts', 'bunyad-widgets') : $instance['title'], $instance, $this->id_base);
        if (empty($instance['number']) || !($number = absint($instance['number']))) {
            $number = 5;
        }
        $query_args = array('posts_per_page' => $number, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => '_bunyad_review_overall');
        // order by rating?
        if (isset($order) && $order == 'rating') {
            $query_args['orderby'] = 'meta_value';
        } else {
            $query_args['orderby'] = 'date';
        }
        $r = new WP_Query(apply_filters('bunyad_widget_latest_reviews_query_args', $query_args));
        // do custom loop if available
        if (has_action('bunyad_widget_latest_review_loop')) {
            $args['title'] = $title;
            do_action('bunyad_widget_latest_review_loop', array_merge($args, $instance), $r);
        } elseif ($r->have_posts()) {
            ?>

			<?php 
            echo $before_widget;
            ?>
			
			<?php 
            if ($title) {
                ?>
				<?php 
                echo $before_title . $title . $after_title;
                ?>
			<?php 
            }
            ?>
			
			<ul class="posts-list">
			
			<?php 
            while ($r->have_posts()) {
                $r->the_post();
                global $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', 'latest-reviews', 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', 'latest-reviews', 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 
            }
            ?>
			</ul>
			
			<?php 
            echo $after_widget;
        }
        // reset the global $the_post as this query will have stomped on it
        wp_reset_postdata();
        $cache[$args['widget_id']] = ob_get_flush();
        set_transient('bunyad_widget_latest_reviews', $cache);
    }
Exemplo n.º 15
0
<?php

/**
 * Fields to show for posts meta box
 */
$options = array(array('label' => __('Featured Slider Post?', 'bunyad-admin'), 'name' => 'featured_post', 'type' => 'checkbox', 'value' => 0), array('label' => __('Post Layout', 'bunyad-admin'), 'name' => 'layout_template', 'type' => 'select', 'options' => array('' => __('Default (from Theme Settings)', 'bunyad-admin'), 'classic' => __('Classic', 'bunyad-admin'), 'cover' => __('Post Cover', 'bunyad-admin'), 'classic-above' => __('Classic - Title First', 'bunyad-admin')), 'value' => ''), array('label' => __('Layout Style', 'bunyad-admin'), 'name' => 'layout_style', 'type' => 'radio', 'options' => array('' => __('Default', 'bunyad-admin'), 'right' => __('Right Sidebar', 'bunyad-admin'), 'full' => __('Full Width', 'bunyad-admin')), 'value' => ''), array('label' => __('Category Label Overlay', 'bunyad-admin'), 'name' => 'cat_label', 'type' => 'html', 'html' => wp_dropdown_categories(array('show_option_all' => __('-- Auto Detect--', 'bunyad-admin'), 'hierarchical' => 1, 'order_by' => 'name', 'class' => '', 'name' => '_bunyad_cat_label', 'echo' => false, 'selected' => Bunyad::posts()->meta('cat_label'))), 'desc' => __('When you have multiple categories for a post, auto detection chooses one in alphabetical order. These labels are shown above image in category listings.', 'bunyad-admin')), array('label' => __('Multi-page Content Slideshow?', 'bunyad-admin'), 'desc' => __('You can use <!--nextpage--> to split a page into multi-page content slideshow.', 'bunyad-admin'), 'name' => 'content_slider', 'type' => 'select', 'value' => 0, 'options' => array('' => __('Disabled', 'bunyad-admin'), 'ajax' => __('AJAX - No Refresh', 'bunyad-admin'), 'refresh' => __('Multi-page - Refresh for next page', 'bunyad-admin'))), array('label_left' => __('Disable Featured?', 'bunyad-admin'), 'label' => __('Do not show featured Image, Video, or Gallery at the top for this post, on post page.', 'bunyad-admin'), 'name' => 'featured_disable', 'type' => 'checkbox', 'value' => 0), array('label' => __('Featured Video Code', 'bunyad-admin'), 'name' => 'featured_video', 'type' => 'textarea', 'options' => array('rows' => 7, 'cols' => 90), 'value' => '', 'allowed_html' => array('iframe' => array('scrolling' => true, 'src' => true, 'width' => true, 'height' => true, 'frameborder' => true))));
if (Bunyad::options()->layout_style == 'boxed') {
    $options[] = array('label' => __('Custom Background Image', 'bunyad-admin'), 'name' => 'bg_image', 'type' => 'upload', 'options' => array('type' => 'image', 'title' => __('Upload This Picture', 'bunyad-admin'), 'button_label' => __('Upload', 'bunyad-admin'), 'insert_label' => __('Use as Background', 'bunyad-admin')), 'value' => '', 'bg_type' => array('value' => 'cover'));
}
	
			<?php 
while ($query->have_posts()) {
    $query->the_post();
    ?>
			
			<div class="post">
				<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 && Bunyad::posts()->meta('reviews')) {
        ?>
					<div class="review rate-number"><span class="progress"></span>
						<span><?php 
        echo Bunyad::posts()->meta('review_overall');
        ?>
</span></div>
				<?php 
    }
    ?>
				
				</a>
				
				<div class="content">
				
					<?php 
 /**
  * Import theme settings and re-configure data
  */
 public function import_theme_settings()
 {
     $data = json_decode(file_get_contents($this->demo_data_path . 'settings.json'), true);
     // remove un-necessary data
     unset($data['shortcodes']);
     // re-map category ids
     $cat_meta = array();
     foreach ($data as $key => $value) {
         if (strstr($key, 'cat_meta_')) {
             $cat_id = intval(substr($key, strlen('cat_meta_')));
             $cat_meta['cat_meta_' . $this->wp_import->processed_terms[$cat_id]] = $value;
         }
     }
     $data = array_merge($data, $cat_meta);
     // update settings and category meta
     if (count($data)) {
         // update options
         Bunyad::options()->set_all($data)->update();
     }
     // remove css cache
     delete_transient('bunyad_custom_css_cache');
 }
$limit_tag = Bunyad::options()->featured_right_tag;
if (!empty($limit_cat)) {
    $args['posts_per_page'] = 5;
    $grid_query = new WP_Query(apply_filters('bunyad_block_query_args', array('cat' => $limit_cat, 'posts_per_page' => 3), 'slider_grid'));
} else {
    if (!empty($limit_tag)) {
        $args['posts_per_page'] = 5;
        $grid_query = new WP_Query(apply_filters('bunyad_block_query_args', array('tag' => $limit_tag, 'posts_per_page' => 3), 'slider_grid'));
    }
}
/*
 * Category slider?
 */
if (is_category()) {
    $cat = get_query_var('cat');
    $meta = Bunyad::options()->get('cat_meta_' . $cat);
    // slider not enabled? quit!
    if (empty($meta['slider'])) {
        return;
    }
    $args['cat'] = $cat;
    // latest posts?
    if ($meta['slider'] == 'latest') {
        unset($args['meta_key'], $args['meta_value']);
    }
}
/*
 * Main slider posts query
 */
// use latest posts?
if (Bunyad::posts()->meta('featured_slider') == 'default-latest') {
 /**
  * Whether a user can rate 
  * 
  * @param integer|null $post_id
  * @param integer|null $user_id
  */
 public function can_rate($post_id = null, $user_id = null)
 {
     if (!$post_id) {
         $post_id = get_the_ID();
     }
     // rating not even enabled
     if (!Bunyad::posts()->meta('reviews', $post_id) or !Bunyad::options()->user_rating) {
         return false;
     }
     // ip check
     $votes = Bunyad::posts()->meta('user_rating', $post_id);
     $user_ip = $this->get_user_ip();
     if (!empty($votes['votes'])) {
         foreach ((array) $votes['votes'] as $time => $data) {
             if (!empty($data[1]) && $data[1] == $user_ip) {
                 return false;
             }
         }
     }
     // cookie check
     if (!empty($_COOKIE['bunyad_user_ratings'])) {
         $ids = (array) explode('|', $_COOKIE['bunyad_user_ratings']);
         if (in_array($post_id, $ids)) {
             return false;
         }
     }
     return true;
 }
    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 
    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 
}
<?php

/**
 * Partial Template for related posts on single pages
 */
?>

<?php 
if (is_single() && Bunyad::options()->related_posts) {
    $related = Bunyad::posts()->get_related(Bunyad::core()->get_sidebar() == 'none' ? 3 : 3);
    if (!$related) {
        return;
    }
    ?>
	
	<section class="related-posts">
		<h3 class="section-head"><?php 
    _e('Related Posts', 'bunyad');
    ?>
</h3> 
		<ul class="highlights-box three-col related-posts">
		
		<?php 
    foreach ($related as $post) {
        setup_postdata($post);
        ?>
		
			<li class="highlights column one-third">
				
				<article>
						
	<?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>
		
    if (!empty($template)) {
        if (!strstr($template, 'modern')) {
            $bunyad_loop_template = 'loop-' . str_replace('-3', '', $template);
        }
        if (strstr($template, '-3')) {
            Bunyad::registry()->loop_grid = 3;
        }
    }
}
// slider for categories
if (is_category()) {
    $meta = Bunyad::options()->get('cat_meta_' . get_query_var('cat'));
    get_template_part('partial-sliders');
}
// enqueue the infinite scrol js if needed
if (Bunyad::options()->pagination_type == 'infinite') {
    wp_enqueue_script('smartmag-infinite-scroll');
}
?>

<div class="main wrap cf">
	<div class="row">
		<div class="col-8 main-content">
	
		<?php 
/* can be combined into one below with is_tag() || is_category() || is_tax() - extended for customization */
?>
		
		<?php 
if (is_tag()) {
    ?>
?>
>

<div class="main-wrap">

	<?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

/**
 * Author Page
 */
get_header();
$authordata = get_userdata(get_query_var('author'));
$loop_template = Bunyad::options()->author_loop_template;
// set correct grid options for grid templates
if (strstr($loop_template, '-3')) {
    Bunyad::registry()->set('loop_grid', 3);
    $loop_template = str_replace('-3', '', $loop_template);
}
?>


<div class="main wrap cf">

	<div class="row">
		<div class="col-8 main-content">
		
			<h1 class="main-heading author-title"><?php 
echo sprintf(__('Author %s', 'bunyad'), '<strong>' . get_the_author() . '</strong>');
?>
</h1>

			<?php 
get_template_part('partials/author');
?>
	
			<?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; }';
            }
        }
    }
				<li>
			
			<?php 
    if ($type == 'thumb') {
        ?>
				
					<a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_post_thumbnail('post-thumbnail', array('title' => strip_tags(get_the_title())));
        ?>

					<?php 
        if (Bunyad::options()->review_show_widgets) {
            ?>
						<?php 
            echo apply_filters('bunyad_review_main_snippet', '');
            ?>
					<?php 
        }
        ?>
					
					</a>
					
					<div class="content">

						<?php 
        echo Bunyad::blocks()->meta('above', 'block-small');
        ?>
        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 
        echo $percent;
        ?>
%;"></div></div>
				
		<?php 
    }
    ?>

		</li>
	
	<?php 
}
?>
	
	<?php 
if (Bunyad::options()->user_rating) {
    ?>
	
		<li class="user-ratings<?php 
    echo !Bunyad::reviews()->can_rate() ? ' voted' : '';
    ?>
" data-post-id="<?php 
    echo get_the_ID();
    ?>
">
			<span class="label"><?php 
    _e('User Ratings', 'bunyad');
    ?>
 <span class="votes">(<?php 
    printf(__('%s Votes', 'bunyad'), '<span class="number">' . Bunyad::reviews()->votes_count() . '</span>');
    ?>