$author = isset($_GET['author_name']) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?> <div class="author author__profile"> <div class="avatar"> <?php kaitain_avatar_background_html($author->ID, 'tc_post_avatar', 'author__photo author-photo'); ?> </div> <div class="author__wrap"> <h1 class="author__name"> <span class="author-link"><a class="green-link--hover" href="<?php printf(get_author_posts_url($author->ID)); ?> "><?php printf($author->display_name); ?> </a></span> </div> </div> <hr> <?php if (have_posts()) { while (have_posts()) { the_post(); kaitain_partial('article', 'archive'); } } kaitain_partial('pagination', 'site'); get_footer();
/** * Widget Public Display * ------------------------------------------------------------------------- * @param array $defaults Widget default values. * @param array $instance Widget instance arguments. */ public function widget($defaults, $instance) { global $sections, $post; if (!($category = get_category($instance['category']))) { return; } // Widget title. $title = apply_filters('widget_title', $category->cat_name); // Transient API name. $trans = 'sidebar_category_posts_' . $category->slug; // Site section information. $section = kaitain_current_section_category(); $trim = kaitain_section_css(get_the_category()[0]); $section_slug = $sections->get_category_section_slug(get_the_category()[0]); $classes = array('widget' => 'widget--sidebarcat vspace--full', 'trim_bg' => 'widget--sidebarcat__bg', 'trim_text' => $trim['texthover']); if ($instance['use_section_trim']) { // Override grey background with appropriate section trim. $classes['trim_bg'] = $trim['bg']; } if (!($category_posts = get_transient($trans))) { // Transient: fetch posts. $category_posts = get_posts(array('post_type' => 'post', 'post_status' => 'publish', 'numberposts' => $instance['max_posts'], 'category' => $instance['category'], 'order' => 'DESC')); set_transient($trans, $category_posts, get_option('kaitain_transient_timeout')); } if (!empty($defaults['before_widget'])) { printf($defaults['before_widget']); } // Widget interior. printf('<div class="%s %s">', $classes['widget'], $classes['trim_bg']); printf('%s<a class="%s" href="%s">%s</a>%s', $defaults['before_title'], $classes['trim_text'], get_category_link($category), $title, $defaults['after_title']); foreach ($category_posts as $index => $post) { setup_postdata($post); if ($instance['show_image'] && $index === 0) { kaitain_partial('article', 'sidebarcatlead'); } else { kaitain_partial('article', 'sidebarcat'); } } printf('</div>'); if (!empty($defaults['after_widget'])) { printf($defaults['after_widget']); } wp_reset_postdata(); }
<?php /** * Archive Template * ----------------------------------------------------------------------------- * @category PHP Script * @package Kaitain * @author Mark Grealish <*****@*****.**> * @copyright Copyright (c) 2014-2015, Tuairisc Bheo Teo * @license https://www.gnu.org/copyleft/gpl.html The GNU GPL v3.0 * @version 2.0 * @link https://github.com/bhalash/kaitain-theme * @link http://www.tuairisc.ie */ get_header(); if (have_posts()) { while (have_posts()) { the_post(); kaitain_partial('article', 'archive'); } } partial('pagination', 'site'); get_footer();
/** * Widget Public Display * ------------------------------------------------------------------------- * @param array $defaults Widget default values. * @param array $instance Widget instance arguments. */ public function widget($defaults, $instance) { global $post; $key = get_option('kaitain_view_counter_key'); $title = apply_filters('widget_title', $instance['widget_title']); $start_date = new DateTime(); $start_date = $start_date->sub(new DateInterval('P' . $instance['elapsed_days'] . 'D')); if (!($popular = get_transient('sidebar_popular_posts'))) { $popular = get_posts(array('post_type' => 'post', 'meta_key' => $key, 'orderby' => 'meta_value_num', 'numberposts' => $instance['max_posts'], 'order' => 'DESC', 'date_query' => array('after' => $start_date->format('Y-m-d'), 'before' => date('Y-m-d'), 'inclusive' => true))); set_transient('sidebar_popular_posts', $popular, get_option('kaitain_transient_timeout')); } if (!empty($defaults['before_widget'])) { printf($defaults['before_widget']); printf($defaults['before_title'] . $title . $defaults['after_title']); } printf('<div class="popular-widget tuairisc-post-widget">'); foreach ($popular as $index => $post) { setup_postdata($post); kaitain_partial('article', 'sidebar'); } printf('</div>'); if (!empty($defaults['after_widget'])) { printf($defaults['after_widget']); } wp_reset_postdata(); }
* @author Mark Grealish <*****@*****.**> * @copyright Copyright (c) 2014-2015, Tuairisc Bheo Teo * @license https://www.gnu.org/copyleft/gpl.html The GNU GPL v3.0 * @version 2.0 * @link https://github.com/bhalash/kaitain-theme * @link http://www.tuairisc.ie */ get_header(); $trim = kaitain_current_section_css(); $section_cat = kaitain_current_section_category(); if (have_posts()) { while (have_posts()) { the_post(); kaitain_partial('article', 'full'); if (function_exists('rp_get_related')) { printf('<h4 class="%s"><a class="%s" href="%s">%s \'%s\'</a></h4>', 'subtitle related-title', $trim['texthover'], get_category_link($section_cat->cat_ID), __('Léigh tuilleadh sa rannóg seo', 'kaitain'), $section_cat->cat_name); printf('<div class="%s">', 'related-articles flex--three-col--article vspace--double noprint'); $related = rp_get_related(array('range' => array('after' => date('Y-m-j') . '-21 days', 'before' => date('Y-m-j')), 'cache' => true)); foreach ($related as $post) { setup_postdata($post); kaitain_partial('article', 'related'); } printf('</div>'); wp_reset_postdata(); } comments_template(); } } else { kaitain_partial('article', 'missing'); } get_footer();
/** * Widget Public Display * ------------------------------------------------------------------------- * @param array $defaults Widget default values. * @param array $instance Widget instance arguments. */ public function widget($defaults, $instance) { // $post object is needed in order to correctly run setup_postdata(). global $post; $classes = array('widget' => 'widget widget--featured', 'post_row' => 'flex--four-col--article vspace--half widget--featured__row'); // Array of featured and sticky posts. $featured = array(); if ($instance['show_sticky']) { /* If sticky was checked, see if it is available to use. Otherwise * grab the last featured post. */ if (kaitain_has_sticky_been_set()) { $featured[] = kaitain_get_sticky_post(); } else { /* If no stick is set, but was asked to display, increment * count to fill. */ $instance['count']++; } } // Show other featured posts if they were elected ot be shown. $featured = array_merge($featured, kaitain_get_featured($instance['count'], true)); if (!empty($defaults['before_widget'])) { printf($defaults['before_widget']); } printf('<div class="%s">', $classes['widget']); // Number modifier for when sticky posts are selected. $mod = $instance['show_sticky'] ? 0 : 1; foreach ($featured as $number => $post) { if (!empty($post)) { setup_postdata($post); if ($instance['show_sticky'] && $number === 0) { kaitain_partial('article', 'lead'); } if (($number + $mod) % 4 === 1) { printf('<div class="%s">', $classes['post_row']); } if (!$instance['show_sticky'] || $number > 0) { kaitain_partial('article', 'small'); } if ($number > 0 && ($number + $mod) % 4 === 0) { printf('</div>'); } } } printf('</div>'); if ($instance['count'] > 1) { printf('<hr>'); } if (!empty($defaults['after_widget'])) { printf($defaults['after_widget']); } wp_reset_postdata(); }
/** * Widget Public Display * ------------------------------------------------------------------------- * @param array $defaults Widget default values. * @param array $instance Widget instance arguments. */ public function widget($defaults, $instance) { global $post; $trans_name = 'sidebar_recent_posts'; $key = get_option('kaitain_view_counter_key'); $title = apply_filters('widget_title', $instance['widget_title']); if (!($recent = get_transient($trans_name))) { $recent = get_posts(array('post_type' => 'post', 'numberposts' => $instance['max_posts'], 'order' => 'DESC', 'category' => $instance['category'] ? $instance['category'] : '')); set_transient($trans_name, $recent, get_option('kaitain_transient_timeout')); } if (!empty($defaults['before_widget'])) { printf($defaults['before_widget']); printf($defaults['before_title'] . $title . $defaults['after_title']); } printf('<div class="recent-widget tuairisc-post-widget">'); foreach ($recent as $post) { setup_postdata($post); kaitain_partial('article', 'sidebar'); } printf('</div>'); if (!empty($defaults['after_widget'])) { printf($defaults['after_widget']); } wp_reset_postdata(); }