foreach (theme_page_rank::get_tabs() as $k => $v) { $active_class = $active_tab === $k ? 'class="active"' : null; ?> <a <?php echo $active_class; ?> href="<?php echo theme_page_rank::get_tabs($k)['url']; ?> "> <i class="fa fa-<?php echo theme_page_rank::get_tabs($k)['icon']; ?> "></i> <?php echo theme_page_rank::get_tabs($k)['tx']; ?> </a> <?php } ?> </nav> <div class="panel-rank"> <?php $include_filepath = __DIR__ . '/tpl/page-rank-' . $active_tab . '.php'; if (is_file($include_filepath)) { include $include_filepath; } else { ?> <div class="content"> <div class="page-tip">
/** * the_recommended */ public static function the_recommended() { if (!class_exists('theme_recommended_post') || !theme_recommended_post::is_enabled()) { return false; } $cache = theme_recommended_post::get_cache(); if (!empty($cache)) { echo $cache; unset($cache); return; } $recomms = theme_recommended_post::get_ids(); if (empty($recomms)) { ?> <div class="page-tip"><?php echo status_tip('info', ___('Please set some recommended posts to display.')); ?> </div> <?php return false; } global $post; $query = new WP_Query(['posts_per_page' => theme_recommended_post::get_item('number'), 'post__in' => $recomms, 'orderby' => 'ID', 'ignore_sticky_posts' => true]); ob_start(); if (have_posts()) { ?> <div class="home-recomm mod panel"> <div class="heading"> <h2 class="title"> <span class="bg"> <?php if (class_exists('theme_page_rank')) { ?> <a href="<?php echo theme_page_rank::get_tabs('recommend')['url']; ?> "> <?php } ?> <?php if (theme_recommended_post::get_item('icon')) { ?> <i class="fa fa-<?php echo theme_recommended_post::get_item('icon'); ?> "></i> <?php } ?> <?php echo theme_recommended_post::get_item('title'); ?> <?php if (class_exists('theme_page_rank')) { ?> </a> <?php } ?> </span> </h2> <?php if (class_exists('theme_page_rank')) { ?> <a href="<?php echo theme_page_rank::get_tabs('recommend')['url']; ?> " class="more"><?php echo ___('more »'); ?> </a> <?php } ?> </div> <div class="row"> <?php foreach ($query->posts as $post) { setup_postdata($post); self::archive_card_lg(['classes' => 'g-tablet-1-2 g-tablet-1-4', 'lazyload' => false]); } wp_reset_postdata(); ?> </div> </div> <?php } unset($query, $recomms); $cache = ob_get_contents(); ob_end_clean(); theme_recommended_post::set_cache($cache); echo $cache; unset($cache); }
<div class="content"> <div class="tab-filter"> <?php $active_filter_tab = get_query_var('filter'); $filter_tabs = theme_page_rank::get_tabs('popular')['filters']; if (!isset($filter_tabs[$active_filter_tab])) { $active_filter_tab = 'day'; } foreach ($filter_tabs as $k => $v) { $active_class = $active_filter_tab === $k ? 'active' : null; ?> <a class="btn btn-default <?php echo $active_class; ?> " href="<?php echo $v['url']; ?> "><?php echo $v['tx']; ?> </a> <?php } ?> </div> <?php $posts_content = theme_page_rank::get_popular_posts(); if (empty($posts_content)) { ?> <div class="page-tip"><?php echo status_tip('info', ___('No data yet.'));