public function widget($args, $instance) { $title = apply_filters('widget_title', $instance['title']); echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } $category = $instance['category']; $unserialized_categories = unserialize($category); $cat_string = is_array($unserialized_categories) ? join(',', $unserialized_categories) : ''; $max_posts = (int) $instance['max_posts']; $autoheight = (int) $instance['autoheight']; $autoplay = (int) $instance['autoplay']; // the query $q = new WP_Query(array('orderby' => 'date', 'posts_per_page' => $max_posts > 0 && $max_posts <= 10 ? $max_posts : 5, 'category__in' => $unserialized_categories, 'meta_key' => '_thumbnail_id')); $list = '<div class="bw-widget-slider-holder">'; $list .= '<ul class="bw-widget-slider ' . ($autoplay ? 'auto-play' : '') . '" ' . ($autoplay ? 'data-speed="3000"' : '') . '>'; while ($q->have_posts()) { $q->the_post(); $size = $autoheight ? 'bw_350' : 'bw_350x300'; if (Bw::get_option('enable_lazy_image')) { $thumbnail = '<img class="lazy" data-src="' . Bw::get_image_src($size) . '" src="' . Bw::empty_img('350x300') . '" alt="">'; } else { $thumbnail = '<img src="' . Bw::get_image_src($size) . '" alt="">'; } $list .= "<li>\n\t\t\t\t<a class='image' href='" . get_permalink() . "'>\n\t\t\t\t\t{$thumbnail}\n\t\t\t\t</a>\n\t\t\t\t<div class='box'>\n\t\t\t\t\t<h4 class='bb'><a href='" . get_permalink() . "' title='" . get_the_title() . "'>" . get_the_title() . "</a></h4>\n\t\t\t\t</div>\n\t\t\t</li>"; } wp_reset_query(); $list .= "</ul>"; $list .= "</div>"; echo $list; echo $args['after_widget']; }
static function generate_fonts() { if (is_array(self::$fonts)) { $protocol = is_ssl() ? 'https' : 'http'; $generate_font_req = ''; $generate_font_css = ''; foreach (self::$fonts as $name => $font) { $custom = false; # check for ot default google fonts $ot_font = Bw::get_option($name . '_font'); if (!empty($ot_font)) { $font['font'] = $ot_font; } # check for ot declared fonts $ot_font_declaration = Bw::get_option($name . '_font_declaration'); if (!empty($ot_font_declaration)) { $font['font'] = $ot_font_declaration; $custom = true; } if ($font['font']) { $generate_font_req[] = str_replace(" ", "+", $font['font']); $rule = join(',', $font['selectors']); $generate_font_css .= $custom ? "{$rule}{font:{$font['font']}}" : "{$rule}{font-family:'{$font['font']}'}"; } } $output_css = join('|', $generate_font_req); wp_enqueue_style('google-fonts', "{$protocol}://fonts.googleapis.com/css?family={$output_css}"); Bw::add_css($generate_font_css); } }
static function custom_js() { $custom_js = Bw::get_option('custom_js'); if ($custom_js) { echo "<script type='text/javascript'>{$custom_js}</script>"; } }
static function style($ot) { # category styling if (is_category()) { if (is_object(get_queried_object()) and !empty(get_queried_object()->term_id)) { $term = get_term(get_queried_object()->term_id, 'category'); $cat_color = get_field('category_color', $term); if (!empty($cat_color)) { $ot['main_color'] = $cat_color; } } } # signle article inherit first category style if (is_single()) { $cat_object = current(get_the_category()); if (is_object($cat_object) and !empty($cat_object->term_id)) { $term = get_term($cat_object->term_id, 'category'); $cat_color = get_field('category_color', $term); if (!empty($cat_color)) { $ot['main_color'] = $cat_color; } } } $style = "\n\t\t\t::selection {background:{$ot['main_color']};color:#fff;}\n\t\t\t::-moz-selection {background:{$ot['main_color']};color:#fff;}\n\t\t"; # bg elements $style .= ".bargraph li span, .post-categories a, .post-tags a, .billboard-slider .info .read-more a:hover, .bw-slider .owl-buttons div:hover, .article-thumb:hover .icon, .woocommerce #content input.button.alt, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce-page #respond input#submit.alt, .woocommerce-page a.button.alt, .woocommerce-page button.button.alt, .woocommerce-page input.button.alt, #footer .reviews article .bar .progress, .reviews article .bar .progress, .widget_tag_cloud a, #header.version-3 .right-content.black .search-submit:hover, #header.version-3 .search-form .search-submit, .page .search-form .search-submit:hover, #header.version-3 .search-form .search-submit:hover, .cat-tags a, .score-box .score, .review-score .bar .progress, .article-thumb .rate, #header .social a:hover {background-color:{$ot['main_color']}!important}"; $style .= "#footer .widget_tag_cloud a:hover {background-color:{$ot['main_color']}!important;}"; # color elements $style .= ".bw-button, .bw-slider .title h3:hover, .article-title h3.bb a:hover, #sidebar .reviews article .bar .score-label a:hover, .bw-megamenu .article-title span:hover, .bw-megamenu .megamenu-slider .item:hover .title h3, .bw-megamenu .small-link:hover, .woocommerce .cart-collaterals .shipping_calculator .shipping-calculator-button, .woocommerce-page .cart-collaterals .shipping_calculator .shipping-calculator-button, .woocommerce .product_meta a, #footer .bw-popular-widget-nav a.active, .widget_archive ul a, .widget_categories ul a, .widget_pages ul a, #content .post table th, .post-author .cont h4 a:hover, .cat-tags-list a, .header-parallax .date strong a:hover, .post-subtitle a:hover, a, a:visited {color:{$ot['main_color']}}"; # other $style .= ".post-tags a:before, .cat-tags a:before {border-right-color:{$ot['main_color']}}"; $style .= "blockquote {border-left:8px solid:{$ot['main_color']}}"; $style .= "#footer #wp-calendar tbody td {border-top:1px solid {$ot['main_color']}}"; $style .= "#footer #wp-calendar tfoot tr td {border-top:1px solid {$ot['main_color']}}"; $style .= ".billboard-slider .info .read-more a:hover, .bw-slider .owl-buttons div:hover, .article-thumb:hover .icon {border-color:{$ot['main_color']}}"; $style .= "blockquote {border-color:{$ot['main_color']}}"; $style .= "\n\t\t\tbody {background-color:{$ot['background_color']}}\n\t\t\t#header .row-holder {background-color:{$ot['header_nav_color']}}\n\t\t\tbody.boxed #header .row-holder .row.for-sub-header {background-color:{$ot['header_nav_color']};}\n\t\t"; $style .= ".papa-grid h3 a {color:#000}"; $style .= ".post-categories a:hover, .post-tags a:hover {background-color:#000!important}"; $style .= ".article-thumb .rate:after {border-color:rgba(" . Bw::color_saturation(Bw::hex2rgb($ot['main_color']), -60) . ",1) transparent}"; if (Bw::get_option('header_white')) { $style .= '#header {background-color:#fff;}'; } if (Bw::get_option('header_nav_color') or Bw::get_option('invert_header_nav_color')) { $style .= '.bw-megamenu {padding-top:15px;}'; } if (Bw::get_option('header_color') and !Bw::get_option('header_white')) { $style .= "#header {background-color:{$ot['header_color']};}"; } if ($ot['background_image']) { $style .= "#bw-bg {background:url('{$ot['background_image']}') no-repeat center center;background-size:cover;background-attachment:fixed;}"; } $style .= self::get_shadow($ot['container_shadow']); printf("<style>%s</style>", $style); }
function widget($args, $instance) { global $comments, $comment; $cache = wp_cache_get('widget_recent_comments', 'widget'); if (!is_array($cache)) { $cache = array(); } if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } extract($args, EXTR_SKIP); $output = ''; $title = !empty($instance['title']) ? $instance['title'] : __('Recent Comments'); $title = apply_filters('widget_title', $title, $instance, $this->id_base); $number = !empty($instance['number']) ? absint($instance['number']) : 5; if (!$number) { $number = 5; } $comments = get_comments(apply_filters('widget_comments_args', array('number' => $number, 'status' => 'approve', 'post_status' => 'publish'))); $output .= $before_widget; if ($title) { $output .= $before_title . $title . $after_title; } $output .= '<ul id="recentcomments" class="bw-sidebar-posts">'; if ($comments) { // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.) $post_ids = array_unique(wp_list_pluck($comments, 'comment_post_ID')); _prime_post_caches($post_ids, strpos(get_option('permalink_structure'), '%category%'), false); foreach ((array) $comments as $comment) { if (Bw::get_option('enable_lazy_image')) { $bw_image = "<img class='lazy' data-src='" . get_avatar_url($comment->user_id) . "' src='" . Bw::empty_img() . "' alt='' >"; } else { $bw_image = "<img src='" . get_avatar_url($comment->user_id) . "' alt='' >"; } $output .= '<li class="recentcomments">'; $output .= '<div class="thumb"><a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">' . $bw_image . '</a></div>'; $output .= '<div class="cont"><a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">' . get_comment_author_link() . '</a>'; $output .= '<p>' . Bw::truncate($comment->comment_content, 7) . '</p></div>'; $output .= '</li>'; } } $output .= '</ul>'; $output .= $after_widget; echo $output; $cache[$args['widget_id']] = $output; wp_cache_set('widget_recent_comments', $cache, 'widget'); }
static function logo() { $ot_logo = Bw::get_option('logo'); $output = ''; $output .= '<div id="logo"><a href="' . esc_url(home_url('/')) . '">'; if (!empty($ot_logo)) { $output .= '<img class="desktop" src="' . Bw::get_option('logo') . '" alt="' . get_bloginfo('name') . '">'; $output .= Bw::get_option('logo_mobile') ? '<img class="mobile" src="' . Bw::get_option('logo_mobile') . '" alt="">' : '<h4 class="bb mobile plain">' . get_bloginfo('name') . '</h4>'; } else { $output .= '<h1>' . get_bloginfo('name') . '</h1><h2>' . get_bloginfo('description') . '</h2>'; } $output .= '</a></div>'; return $output; }
static function verify_user() { # proceed if automatic updates are enabled $enable_updates = Bw::get_option('enable_updates'); if (!$enable_updates) { return; } # use credentials used in toolkit plugin $credentials = get_option('envato-wordpress-toolkit'); if (empty($credentials['user_name']) || empty($credentials['api_key'])) { # display a notice in the admin to remind the user to enter their credentials add_action('admin_notices', array('Bw_updater', 'admin_notices')); return; } else { if (!self::set_timeout()) { self::check_for_updates($credentials); } } }
static function enqueue_assets() { # css Bw_assets::addStyle('style', 'style.css'); Bw_assets::addStyle('bw-owl-carousel', 'assets/css/vendors/jquery.owl.carousel/owl.carousel.all.css'); Bw_assets::addStyle('bw-magnific-popup', 'assets/css/vendors/jquery.magnific-popup/magnific-popup.css'); Bw_assets::addStyle('bw-animate', 'assets/css/vendors/animate/animate.css'); Bw_assets::addStyle('bw-style', 'assets/css/style.css'); Bw_assets::addStyle('bw-media', 'assets/css/media.css'); # js if (Bw::get_option('enable_smooth_scroll')) { Bw_assets::addScript('bw-smooth-scroll', 'assets/js/vendors/jquery.smooth-scroll/jquery.smooth-scroll.js', array(), BW_VERSION, false); } Bw_assets::addScript('bw-unveil-master', 'assets/js/vendors/jquery.unveil-master/jquery.unveil.min.js'); Bw_assets::addScript('bw-owl-transitions', 'assets/js/vendors/jquery.owl.slider/owl.carousel.js'); Bw_assets::addScript('bw-magnific-popup-js', 'assets/js/vendors/jquery.magnific-popup/jquery.magnific-popup.min.js'); Bw_assets::addScript('bw-hover-intent', 'assets/js/vendors/jquery.hover-intent/jquery.hover-intent.min.js'); Bw_assets::addScript('bw-masonry', 'assets/js/vendors/jquery.masonry/isotope.pkgd.min.js'); Bw_assets::addScript('bw-tween-max', 'assets/js/vendors/tween-max/tweenmax.min.js'); Bw_assets::addScript('bw-main', 'assets/js/main.js', array('jquery')); }
<script type="text/javascript"> var addthis_config = { ui_click : false, ui_508_compliant : false, ui_use_css : true, data_track_addressbar : false, data_track_clickback : false }; addthis_share = { url : "<?php echo get_permalink(); ?> ", title : "<?php Bw::page_title(); ?> ", description : "<?php echo trim(strip_tags(get_the_excerpt())); ?> " }; </script> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-534b93e766f14c42"></script> <!-- AddThis Button END --> </div> </div> <?php
} ?> <?php if (Bw::get_meta('bw_gallery')) { ?> <div class="bw-slider-holder gallery"> <ul class="post-gallery bw-slider slider-pagination <?php echo $slider_options; ?> " data-effect="<?php echo $slider_effect; ?> "> <?php foreach (Bw::gallerize_by_id(Bw::get_meta('bw_gallery'), Bw::get_meta_checkbox('auto_height') ? 'bw_700' : 'bw_980x600') as $image) { ?> <li class="item"> <div class="article-thumb"> <img src="<?php echo $image['thumb'][0]; ?> " alt="<?php echo $image['title']; ?> "> </div> </li> <?php } ?>
static function get_rate() { if (Bw::has_average_score()) { return "<span class=\"rate bb\">" . Bw::get_average_score() . "</span>"; } return; }
<div id="mobile-menu"> <?php if (Bw::get_option('mobile_nav_search')) { ?> <div class="field"> <?php get_search_form(); ?> </div> <?php } ?> <div class="field"> <?php wp_nav_menu(array('theme_location' => 'primary')); ?> </div> <div class="field"> <?php wp_nav_menu(array('theme_location' => 'top_left')); ?> </div> <div class="field"> <?php wp_nav_menu(array('theme_location' => 'top_right')); ?> </div>
the_post(); ?> <?php get_template_part('templates/post-templates/content-grid'); ?> <?php } ?> </div> </div> <?php Bw::paging_nav(); ?> <?php } else { ?> <?php get_template_part('templates/content/content', 'none'); ?> <?php } ?> </div> <!-- #content -->
<?php /** * The Sidebar containing the main widget areas. * * @package Bad Weather */ ?> <?php if (Bw::get_meta('page_layout') == 'right' or is_search() or is_category() or basename(@get_page_template()) == 'custom-page-builder.php' or get_post_type() == 'post' && Bw::get_meta('page_layout') !== 'full' or Bw_woo::woo_active_plugin() and is_shop() and Bw_woo::post_meta_shop('page_layout') == 'right' or Bw_woo::woo_active_plugin() and is_product_category() and Bw_woo::post_meta_shop('page_layout') == 'right') { ?> <div id="sidebar" class="<?php echo basename(get_page_template()) == 'custom-page-builder.php' ? 'custom' : ''; ?> "> <?php $sidebar = Bw_woo::is_woo() ? 'sidebar-shop' : 'sidebar-1'; ?> <?php if (!dynamic_sidebar($sidebar)) { ?> <aside id="search" class="widget widget_search"> <?php get_search_form(); ?> </aside>
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { global $wp_query; if (!is_array($args)) { $args = (array) $args; } // depth dependent classes $depth_classes = array('depth-' . $depth); $depth_class_names = esc_attr(implode(' ', $depth_classes)); // passed classes $classes = empty($item->classes) ? array() : (array) $item->classes; #d($classes); $class_names = esc_attr(implode(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item))); // build html $output .= '<li id="nav-item-' . $item->ID . '" class="nav-item ' . $depth_class_names . ' ' . $class_names . ' hidden">'; // link attributes $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : ''; $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : ''; $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : ''; $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : ''; $attributes .= ' class="menu-link ' . ($depth > 0 ? 'sub-menu-link' : 'main-menu-link') . '"'; $item_output = sprintf('%1$s<a%2$s>%3$s%4$s%5$s%6$s</a>%7$s', $args['before'], $attributes, $args['link_before'], apply_filters('the_title', $item->title, $item->ID), $args['link_after'], $depth == 0 ? '<i class="fa fa-circle"></i>' : '', $args['after']); //the megamenu wrapper if ($depth == 0) { $item_output .= '<div class="bw-megamenu hidden bw-over"><div class="megamenu-grid">'; } if ($depth == 0 && ($item->object == 'category' || $item->object == 'post_format')) { //lets get the meta associated with the menu item to see what layout to use $menu_layout = esc_attr(get_post_meta($item->ID, 'bw_megamenu_layout', TRUE)); //$menu_layout = 'latest_posts'; $numberposts = 4; //we start of with 5 posts and decrease from here //if the menu has children then pull fewer posts if ($item->hasChildren) { $numberposts--; } if (!empty($menu_layout)) { $post_args = array('posts_per_page' => 6, 'offset' => 0, 'post_type' => 'post', 'post_status' => 'publish'); if ($item->object == 'category') { $post_args['cat'] = $item->object_id; } elseif ($item->object == 'product_cat') { $post_args['taxonomy'] = 'product_cat'; $post_args['post_type'] = 'product'; } elseif ($item->object == 'post_format') { //first get the post format information $menu_item_post_format = get_term($item->object_id, 'post_format'); $post_args['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array($menu_item_post_format->slug))); } //decrease the number of post by 2 if we have a slider if ($menu_layout == 'slider_latest_posts') { $numberposts -= 2; } global $post; //hold the post slides ids so we exclude them from the rest of the posts $slideposts_ids = array(); //create the markup for the category posts slider if ($menu_layout == 'slider_latest_posts') { //lets grab the posts that are marked as being part of the category slider $post_args['meta_query'] = array(array('key' => 'bw_category_slider', 'value' => '1')); $slideposts = new WP_Query($post_args); $item_output .= '<div class="item one-half">'; if ($slideposts->have_posts()) { $item_output .= '<div class="megamenu-slider bw-slider bw-over">'; while ($slideposts->have_posts()) { $slideposts->the_post(); //add the id to the array $slideposts_ids[] = $post->ID; $post_title = get_the_title(); $post_link = get_permalink(); $image = Bw::get_image_src('bw_475x293'); if (!empty($image)) { if ($image) { $menu_post_image = '<img src="' . $image . '" alt="' . $post_title . '">'; } else { $menu_post_image = ''; } $item_output .= '<article class="item">' . '<a class="item-url" href="' . $post_link . '">' . '<div class="article-thumb">' . '<div class="image-hide">' . '<div class="image-wrap">' . $menu_post_image . '</div>' . '</div>' . '</div>' . '<div class="title shadow">' . '<h3>' . $post_title . '</h3>' . '</div>' . '</a>' . '</article>'; } } $item_output .= '</div>'; } else { $item_output .= '<div class="no-slides-message">'; $item_output .= __('No posts added to the category slider in this category', BW_THEME); $item_output .= '</div>'; } $item_output .= '</div>'; wp_reset_postdata(); //a bit of clean up unset($post_args['meta_query']); } if ($menu_layout == 'latest_posts' || $menu_layout == 'slider_latest_posts') { $post_args['posts_per_page'] = $numberposts; $post_args['post__not_in'] = $slideposts_ids; // only posts with thumbnails //$post_args['meta_query'] = array( array( 'key' => '_thumbnail_id' ) ); $menuposts = new WP_Query($post_args); while ($menuposts->have_posts()) { $menuposts->the_post(); $post_title = get_the_title(); $post_link = get_permalink(); if (has_post_thumbnail()) { $image = Bw::get_image_src('bw_350x300'); } else { $image = BW_URI_ASSETS . 'img/empty/350x300.png'; } if ($image) { $menu_post_image = '<div class="article-thumb">'; $menu_post_image .= '<div class="image-hide"><div class="image-wrap"><img src="' . $image . '" alt="' . $post_title . '"></div></div><span class="over"></span>'; $menu_post_image .= '</div>'; } else { $menu_post_image = ''; } $item_output .= '<div class="item one-fourth">' . '<article class="article">' . '<a href="' . $post_link . '">' . $menu_post_image . '<div class="article-content"> <h2 class="article-title">' . '<span>' . $post_title . '</span>' . '</h2> <span class="small-link">' . __('Read More', BW_THEME) . '<em>+</em></span> </div> </a>' . '</article>' . '</div>'; } wp_reset_postdata(); } } } if ($depth == 0) { $item_output .= '</div>'; } // build html $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); }
* The template used for displaying page content in page.php * * @package Bad Weather */ ?> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php if (!Bw::get_meta('hide_title')) { ?> <div class="heading"> <h1 class="page-title"><?php the_title(); ?> </h1> </div> <?php } ?> <?php the_content(); ?>
<div id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <h1><?php the_title(); ?> </h1> <ul> <?php foreach (Bw::gallerize_by_id(Bw::get_meta('bw_gallery')) as $image) { ?> <li> <img src="<?php echo $image['thumb'][0]; ?> " alt="<?php echo $image['title']; ?> "> </li> <?php } ?> </ul>
</div> <div class="column column-3"> <?php dynamic_sidebar('footer_3'); ?> </div> </div> <div class="bottom"> <div class="row"> <!-- footer copyright --> <p><?php Bw::the_option('footer_copy'); ?> </p> <!-- footer navigation --> <nav id="bottom-menu" class="bw-menu"><?php wp_nav_menu(array('theme_location' => 'footer')); ?> </nav> </div> </div> </footer> <span class="clear"></span>
<div class="article-date"> <?php $grid_date = get_the_date(); ?> <?php $grid_category = get_the_category_list(', '); ?> <?php $grid_separator = (!empty($grid_date) and !empty($grid_category)) ? ' / ' : ''; ?> <?php echo "{$grid_date}{$grid_separator}{$grid_category}"; ?> </div> <?php echo Bw::truncate(get_the_excerpt(), 10); ?> </div> </article> <?php $content_right .= ob_get_contents(); ob_end_clean(); } $c++; } wp_reset_postdata(); ?> <div class="papa-grid bw-over"> <article class="part left-part">
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $number = !empty($instance['number']) ? absint($instance['number']) : 5; $query_args = array('posts_per_page' => $number, 'meta_query' => array(array('key' => 'enable_post_review', 'value' => '1'))); $reviews_query = new WP_Query($query_args); echo $before_widget; if ($reviews_query->have_posts()) { ?> <?php if ($title) { ?> <h3 class="widget-title"> <span><?php echo $title; ?> </span> </h3> <?php } ?> <ol class="reviews"> <?php while ($reviews_query->have_posts()) { $reviews_query->the_post(); ?> <li class="review"> <article> <div class="bar"> <div class="score-label"> <a href="<?php the_permalink(); ?> "> <?php the_title(); ?> </a> </div> <div class="bar"> <div class="progress" style="width: <?php echo Bw::get_average_score() * 10; ?> %;"></div> </div> <?php $average_score = Bw::get_average_score(); ?> <span class="badge bb"><?php echo $average_score ? $average_score : ' '; ?> </span> </div> </article> </li> <?php } ?> </ol> <?php } // Reset Post Data wp_reset_postdata(); wp_reset_query(); echo $after_widget; }
while (have_posts()) { the_post(); ?> <?php get_template_part('templates/content/content-page'); ?> <?php if (Bw::get_option('comment_type_page') == 'facebook') { ?> <?php get_template_part('templates/comments/facebook'); ?> <?php } elseif (Bw::get_option('comment_type_page') == 'wp_comments') { ?> <?php if (comments_open() || '0' != get_comments_number()) { comments_template(); } ?> <?php } else { ?> <!-- comments are disabled --> <?php } ?> <?php
if (count($slideposts)) { ?> <div class="bw-slider-holder"> <div class="category-slider-loader"> <div class="category-slider bw-slider <?php echo $autoplay ? 'auto-play' : ''; ?> " data-speed="3000" data-transition="<?php echo !$effect ? 'slide' : $effect; ?> "> <?php foreach ($slideposts as $post) { setup_postdata($post); $thumb_img = Bw::get_image_src('bw_700x450'); if (!empty($thumb_img)) { ?> <article class="item"> <div class="article-thumb"> <img src="<?php echo $thumb_img; ?> " alt="<?php the_title(); ?> " > </div> <div class="title shadow">
<?php if (Bw::has_average_score() && get_field('score_box') == 'before') { ?> <div class="score-box"> <div class="score"> <?php echo Bw::get_average_score(); ?> </div> <?php if (get_field('score_note')) { echo '<div class="score-note">' . get_field('score_note') . '</div>'; } ?> </div> <?php }
<div id="breadcrumb"> <div class="row"> <?php Bw::the_breadcrumb(); ?> </div> </div>
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts', BW_THEME) : $instance['title'], $instance, $this->id_base); if (empty($instance['number']) || !($number = absint($instance['number']))) { $number = 10; } $r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true))); if ($r->have_posts()) { echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="bw-sidebar-posts"> <?php while ($r->have_posts()) { $r->the_post(); ?> <li class="<?php if (!has_post_thumbnail()) { echo 'auto'; } ?> "> <?php if (has_post_thumbnail()) { ?> <div class="thumb"> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <?php if (Bw::get_option('enable_lazy_image')) { ?> <img class="lazy" data-src="<?php echo Bw::get_image_src('thumbnail'); ?> " src="<?php echo Bw::empty_img(); ?> " alt="" > <?php } else { ?> <img src="<?php echo Bw::get_image_src('thumbnail'); ?> " alt="" > <?php } ?> </a> </div> <?php } ?> <div class="cont <?php if (!has_post_thumbnail()) { echo ' no-thumb'; } ?> "> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <?php the_title(); ?> </a> <p><?php echo Bw::truncate(get_the_excerpt(), 6); ?> </p> </div> </li> <?php } ?> </ul> <?php echo $after_widget; wp_reset_postdata(); } }
<div class="bw-slider-holder billboard"> <div class="billboard-slider bw-slider <?php echo $slider_auto_play ? 'auto-play' : ''; ?> " data-transition="<?php echo $slider_transition; ?> " data-speed="<?php echo $slider_auto_play_delay; ?> "> <?php foreach ($slideposts as $post) { setup_postdata($post); $thumb_img = Bw::get_image_src('bw_980x600'); if (!empty($thumb_img)) { ?> <article class="item"> <div class="article-thumb"> <img src="<?php echo $thumb_img; ?> " alt="<?php the_title(); ?> " > </div> <div class="info">
" > <?php } ?> </div> </div> <span class="over"></span> <?php echo Bw::get_format_icon(); ?> <?php echo Bw::get_rate(); ?> <?php } ?> </div> </a> </div> <div class="article-content"> <div class="article-title"> <h3 class="bb"><a href="<?php
public function query_by_id($time, $instance) { global $wpdb; global $post; $limit = (int) $instance['max_posts'] > 0 && (int) $instance['max_posts'] <= 10 ? (int) $instance['max_posts'] : 5; //$categories = unserialize( $instance['category'] ); //$joined_categories = is_array( $categories ) ? join( ',', $categories ) : null; if ($time !== 'bw-all-time' && $time > 0) { $joins = "\r\n\t\t\t\tLEFT JOIN {$wpdb->term_relationships} ON({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)\r\n\t\t\t\tLEFT JOIN {$wpdb->term_taxonomy} ON({$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id)\r\n\t\t\t\tLEFT JOIN {$wpdb->terms} ON({$wpdb->term_taxonomy}.term_id = {$wpdb->terms}.term_id)\r\n\t\t\t"; $where = "\r\n\t\t\t\tAND {$wpdb->term_taxonomy}.taxonomy = 'category'\r\n\t\t\t\tAND {$wpdb->terms}.term_id = '" . $time . "'\r\n\t\t\t"; } else { $joins = ''; $where = ''; } $querystr = "\r\n\t\t\t\r\n\t\t\tSELECT *, CAST({$wpdb->posts}.post_date AS DATE) as bw_date\r\n\t\t\tFROM {$wpdb->posts}\r\n\t\t\tLEFT JOIN {$wpdb->postmeta} ON({$wpdb->posts}.ID = {$wpdb->postmeta}.post_id)\r\n\t\t\t\t\r\n\t\t\t\t" . $joins . "\r\n\t\t\t\r\n\t\t\tWHERE {$wpdb->postmeta}.meta_key = 'post_views_count'\r\n\t\t\tAND {$wpdb->posts}.post_status = 'publish'\r\n\t\t\tAND {$wpdb->posts}.post_date < NOW()\r\n\t\t\tAND {$wpdb->posts}.post_type = 'post'\r\n\t\t\t\t\r\n\t\t\t\t" . $where . "\r\n\t\t\t\r\n\t\t\tORDER BY bw_date desc, {$wpdb->postmeta}.meta_value+0 desc\r\n\t\t\t\r\n\t\t\tLIMIT " . $limit . "\r\n\t\t\t\r\n\t\t"; $pageposts = $wpdb->get_results($querystr, object); $c = 1; echo '<ul class="bw-sidebar-posts ' . trim($time) . '">'; foreach ($pageposts as $post) { setup_postdata($post); ?> <li> <!--div class="position"> <?php echo sprintf("%02d", $c); ?> </div--> <?php if (has_post_thumbnail()) { ?> <div class="thumb"> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <?php if (Bw::get_option('enable_lazy_image')) { ?> <img class="lazy" data-src="<?php echo Bw::get_image_src('thumbnail'); ?> " src="<?php echo Bw::empty_img(); ?> " alt="" > <?php } else { ?> <img src="<?php echo Bw::get_image_src('thumbnail'); ?> " alt="" > <?php } ?> </a> </div> <?php } ?> <div class="cont <?php if (!has_post_thumbnail()) { echo ' no-thumb'; } ?> "> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <?php the_title(); ?> </a> <p><?php echo Bw::truncate(get_the_excerpt(), 7); ?> </p> </div> </li><?php $c++; } wp_reset_postdata(); echo '</ul>'; }
<?php /* Template Name: Custom Page Builder */ get_header(); ?> <div id="content" class="<?php Bw::content_class(); ?> "> <?php while (has_sub_field("blocks")) { switch (true) { # Billboard slider case get_row_layout() == "billboard_slider": get_template_part('templates/acf-layouts/billboard-slider'); break; # Billboard posts # Billboard posts case get_row_layout() == "billboard_posts": get_template_part('templates/acf-layouts/billboard-posts'); break; # Posts grid # Posts grid case get_row_layout() == "posts_grid": get_template_part('templates/acf-layouts/posts-grid'); break; # Heading title
/*----------------------------------------------------*/ function d($what) { print '<pre>'; print_r($what); print '</pre>'; } /*----------------------------------------------------*/ /* Define bw variables /*----------------------------------------------------*/ define('BW_THEME', 'marroco'); define('DS', DIRECTORY_SEPARATOR); define('BW_FRAME_ROOT', dirname(__FILE__) . DS); define('BW_FRAME_CORE', BW_FRAME_ROOT . 'core' . DS); define('BW_FRAME_ASSETS', BW_FRAME_ROOT . 'assets' . DS); define('BW_FRAME_LIB', BW_FRAME_ROOT . 'lib' . DS); define('BW_FRAME_PLUGINS', BW_FRAME_ROOT . 'plugins' . DS); define('BW_ROOT', dirname(BW_FRAME_ROOT) . DS); define('BW_DEMO', BW_ROOT . 'bw' . DS . 'demo' . DS); define('BW_VERSION', '1.4'); define('BW_URI', get_template_directory_uri() . '/'); define('BW_URI_ASSETS', BW_URI . 'assets/'); define('BW_URI_FRAME_ASSETS', BW_URI . 'bw/assets/'); # require core feature require 'core/Bw.php'; /*----------------------------------------------------*/ /* Dynamically load in all classes /*----------------------------------------------------*/ Bw::require_all(array(BW_FRAME_CORE)); Bw::init();