function mh_loop_meta() { $options = mh_theme_options(); $post_date = !$options['post_meta_date']; $post_comments = !$options['post_meta_comments']; if ($post_date || $post_comments) { echo '<p class="meta">'; if ($post_date) { echo get_the_date(); } if ($post_date && $post_comments) { echo ' // '; } if ($post_comments) { mh_comment_count(); } echo '</p>' . "\n"; } }
function mh_post_meta() { $options = mh_theme_options(); $post_date = !$options['post_meta_date']; $post_author = !$options['post_meta_author']; $post_cat = !$options['post_meta_cat']; $post_comments = !$options['post_meta_comments']; if ($post_date || $post_author || $post_cat || $post_comments) { echo '<p class="meta post-meta">'; if ($post_date || $post_author || $post_cat) { $post_date ? $date = sprintf(_x('on %s', 'post date', 'mh'), '<span itemprop="dateModified" class="updated">' . get_the_date() . '</span> ') : ($date = ''); $post_author ? $byline = sprintf(_x('by %s', 'post author', 'mh'), '<span class="vcard author" itemprop="author" itemscope itemtype="http://schema.org/Person"><a class="fn" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" itemprop="name">' . esc_html(get_the_author()) . '</a></span> ') : ($byline = ''); $post_cat ? $category = sprintf(_x('in %s', 'post category', 'mh'), get_the_category_list(', ', '')) : ($category = ''); printf(_x('Posted %1$s %2$s %3$s', 'post meta', 'mh'), $date, $byline, $category); if ($post_comments) { echo ' // '; } } if ($post_comments) { mh_comment_count(); } echo '</p>' . "\n"; } }
?> <div class="loop-thumb"> <a href="<?php the_permalink(); ?> "><?php echo $thumbnail; ?> </a> </div> <?php } ?> <header class="loop-data"> <h3 class="loop-title"><a href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a></h3> <p class="meta"><?php echo get_the_date() . ' | '; mh_comment_count(); ?> </p> </header> <?php mh_excerpt($options['excerpt_length']); ?> </article>
function mh_post_meta() { echo '<p class="meta post-meta">'; $date = sprintf(_x('on %s', 'post date', 'mh-corporate-basic'), '<span class="updated">' . get_the_date() . '</span> '); $byline = sprintf(_x('by %s', 'post author', 'mh-corporate-basic'), '<span class="vcard author"><a class="fn" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span> '); $category = sprintf(_x('in %s', 'post category', 'mh-corporate-basic'), get_the_category_list(', ', '')); printf(_x('Posted %1$s %2$s %3$s', 'post meta', 'mh-corporate-basic'), $date, $byline, $category); echo ' | '; mh_comment_count(); echo '</p>' . "\n"; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $category = isset($instance['category']) ? $instance['category'] : ''; $postcount = empty($instance['postcount']) ? '5' : $instance['postcount']; $offset = empty($instance['offset']) ? '' : $instance['offset']; $sticky = isset($instance['sticky']) ? $instance['sticky'] : 1; echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } ?> <ul class="cp-widget clearfix"> <?php $args = array('posts_per_page' => $postcount, 'offset' => $offset, 'cat' => $category, 'ignore_sticky_posts' => $sticky); $counter = 1; $widget_loop = new WP_Query($args); while ($widget_loop->have_posts()) { $widget_loop->the_post(); if ($counter == 1) { ?> <li class="cp-wrap clearfix"> <div class="cp-thumb-xl"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php if (has_post_thumbnail()) { the_post_thumbnail('cp_large'); } else { echo '<img src="' . get_template_directory_uri() . '/images/noimage_cp_large.png' . '" alt="No Picture" />'; } ?> </a></div> <div class="cp-data"> <h3 class="cp-xl-title"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a></h3> <p class="meta"> <?php $post_date = get_the_date(); ?> <?php echo $post_date . ' | '; ?> <?php mh_comment_count(); ?> </p> </div> <?php mh_excerpt(); ?> </li><?php } else { ?> <li class="cp-wrap cp-small clearfix"> <div class="cp-thumb"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php if (has_post_thumbnail()) { the_post_thumbnail('cp_small'); } else { echo '<img src="' . get_template_directory_uri() . '/images/noimage_70x53.png' . '" alt="No Picture" />'; } ?> </a></div> <div class="cp-data"> <p class="cp-widget-title"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a></p> <p class="meta"><?php comments_number(__('0 Comments', 'mh-corporate-basic'), __('1 Comment', 'mh-corporate-basic'), __('% Comments', 'mh-corporate-basic')); ?> </p> </div> </li><?php } $counter++; } wp_reset_postdata(); ?> </ul><?php echo $after_widget; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $category = isset($instance['category']) ? $instance['category'] : ''; $cats = empty($instance['cats']) ? '' : $instance['cats']; $tags = empty($instance['tags']) ? '' : $instance['tags']; $postcount = empty($instance['postcount']) ? '5' : $instance['postcount']; $offset = empty($instance['offset']) ? '' : $instance['offset']; $order = isset($instance['order']) ? $instance['order'] : 'date'; $excerpt = isset($instance['excerpt']) ? $instance['excerpt'] : 'none'; $excerpt_length = empty($instance['excerpt_length']) ? '175' : $instance['excerpt_length']; $link = empty($instance['link']) ? '' : $instance['link']; $thumbnails = isset($instance['thumbnails']) ? $instance['thumbnails'] : 'show_thumbs'; $sticky = isset($instance['sticky']) ? $instance['sticky'] : 1; $date = isset($instance['date']) ? $instance['date'] : 0; $comments = isset($instance['comments']) ? $instance['comments'] : 0; if ($link) { $before_title = $before_title . '<a href="' . esc_url($link) . '" class="widget-title-link">'; $after_title = '</a>' . $after_title; } elseif ($category) { $cat_url = get_category_link($category); $before_title = $before_title . '<a href="' . esc_url($cat_url) . '" class="widget-title-link">'; $after_title = '</a>' . $after_title; } if ($cats) { $category = $category . ', ' . $cats; } echo $before_widget; if (!empty($title)) { echo $before_title . esc_attr($title) . $after_title; } $thumbnails == 'show_thumbs' || $thumbnails == 'hide_large' ? $cp_no_image = '' : ($cp_no_image = ' cp-no-image'); ?> <ul class="cp-widget<?php echo $cp_no_image; ?> clearfix"> <?php $args = array('posts_per_page' => $postcount, 'offset' => $offset, 'cat' => $category, 'tag' => $tags, 'orderby' => $order, 'ignore_sticky_posts' => $sticky); $counter = 1; $widget_loop = new WP_Query($args); while ($widget_loop->have_posts()) { $widget_loop->the_post(); if ($counter == 1 && $excerpt == 'first' || $excerpt == 'all') { ?> <li class="cp-wrap cp-large clearfix"> <?php if ($thumbnails == 'show_thumbs' || $thumbnails == 'hide_small') { ?> <div class="cp-thumb-xl"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php if (has_post_thumbnail()) { the_post_thumbnail('cp_large'); } else { echo '<img class="mh-image-placeholder" src="' . get_template_directory_uri() . '/images/noimage_300x225.png' . '" alt="No Picture" />'; } ?> </a></div> <?php } ?> <div class="cp-data"> <h3 class="cp-xl-title"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a></h3> <?php if ($date == 0 || $comments == 0) { ?> <p class="meta"><?php if ($date == 0) { $post_date = get_the_date(); echo $post_date; } if ($date == 0 && $comments == 0) { echo ' // '; } if ($comments == 0) { mh_comment_count(); } ?> </p> <?php } ?> </div> <?php mh_excerpt($excerpt_length); ?> </li><?php } else { ?> <li class="cp-wrap cp-small clearfix"> <?php if ($thumbnails == 'show_thumbs' || $thumbnails == 'hide_large') { ?> <div class="cp-thumb"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php if (has_post_thumbnail()) { the_post_thumbnail('cp_small'); } else { echo '<img class="mh-image-placeholder" src="' . get_template_directory_uri() . '/images/noimage_cp_small.png' . '" alt="No Picture" />'; } ?> </a></div> <?php } ?> <div class="cp-data"> <p class="cp-widget-title"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a></p> <?php if ($comments == 0) { ?> <p class="meta"><?php mh_comment_count(); ?> </p> <?php } ?> </div> </li><?php } $counter++; } wp_reset_postdata(); ?> </ul><?php echo $after_widget; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $category = isset($instance['category']) ? $instance['category'] : ''; $cats = empty($instance['cats']) ? '' : $instance['cats']; $tags = empty($instance['tags']) ? '' : $instance['tags']; $offset = empty($instance['offset']) ? '' : $instance['offset']; $order = isset($instance['order']) ? $instance['order'] : 'date'; $width = isset($instance['width']) ? $instance['width'] : 'normal_sl'; $excerpt_length = empty($instance['excerpt_length']) ? '175' : $instance['excerpt_length']; $excerpt = isset($instance['excerpt']) ? $instance['excerpt'] : 0; $meta = isset($instance['meta']) ? $instance['meta'] : 0; $date = isset($instance['date']) ? $instance['date'] : 0; $comments = isset($instance['comments']) ? $instance['comments'] : 0; if ($cats) { $category = $category . ', ' . $cats; } echo $before_widget; ?> <article class="spotlight"><?php $args = array('posts_per_page' => 1, 'cat' => $category, 'tag' => $tags, 'offset' => $offset, 'orderby' => $order, 'ignore_sticky_posts' => 1); $spotlight_loop = new WP_Query($args); while ($spotlight_loop->have_posts()) { $spotlight_loop->the_post(); ?> <?php if ($title) { ?> <div class="sl-caption"><?php echo esc_attr($title); ?> </div> <?php } ?> <div class="sl-thumb"> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php if (has_post_thumbnail()) { if ($width == 'normal_sl') { the_post_thumbnail('spotlight'); } else { the_post_thumbnail('slider'); } } else { if ($width == 'normal_sl') { echo '<img class="mh-image-placeholder" src="' . get_template_directory_uri() . '/images/noimage_580x326.png' . '" alt="No Picture" />'; } else { echo '<img class="mh-image-placeholder" src="' . get_template_directory_uri() . '/images/noimage_940x400.png' . '" alt="No Picture" />'; } } ?> </a> </div> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><h2 class="sl-title"><?php the_title(); ?> </h2></a> <?php if ($meta == 0) { ?> <?php if ($date == 0 || $comments == 0) { ?> <p class="meta"><?php if ($date == 0) { $post_date = get_the_date(); echo $post_date; } if ($date == 0 && $comments == 0) { echo ' // '; } if ($comments == 0) { mh_comment_count(); } ?> </p> <?php } ?> <?php } ?> <?php if ($excerpt == 0) { ?> <?php mh_excerpt($excerpt_length); ?> <?php } } wp_reset_postdata(); ?> </article><?php echo $after_widget; }