function presscore_search_title_shortcode() { $title = ''; $wrap_class = ''; if (is_search()) { $title = get_search_query(); } else { if (is_archive()) { if (is_category()) { $title = single_cat_title('', false); } elseif (is_tag()) { $title = single_tag_title('', false); } elseif (is_author()) { the_post(); $title = '<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a>'; $wrap_class .= ' vcard'; rewind_posts(); } elseif (is_day()) { $title = '<span>' . get_the_date() . '</span>'; } elseif (is_month()) { $title = '<span>' . get_the_date('F Y'); } elseif (is_year()) { $title = '<span>' . get_the_date('Y'); } elseif (is_tax('dt_portfolio_category')) { $title = single_term_title('', false); } elseif (is_tax('dt_gallery_category')) { $title = single_term_title('', false); } } } if ($title) { $title = '<span' . ($wrap_class ? ' class="' . esc_attr($wrap_class) . '"' : '') . '>' . $title . '</span>'; } return $title; }
/** * Prints HTML with meta information for the current post-date/time and author. */ function square_posted_on() { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if (get_the_time('U') !== get_the_modified_time('U')) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; } $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date())); $posted_on = sprintf(esc_html_x('%s', 'post date', 'square'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>'); $byline = sprintf(esc_html_x('by %s', 'post author', 'square'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>'); $comment_count = get_comments_number(); // get_comments_number returns only a numeric value if (comments_open()) { if ($comment_count == 0) { $comments = __('No Comments', 'square'); } elseif ($comment_count > 1) { $comments = $comment_count . __(' Comments', 'square'); } else { $comments = __('1 Comment', 'square'); } $comment_link = '<a href="' . get_comments_link() . '">' . $comments . '</a>'; } else { $comment_link = __(' Comment Closed', 'square'); } echo '<span class="posted-on"><i class="fa fa-clock-o"></i>' . $posted_on . '</span><span class="byline"> ' . $byline . '</span><span class="comment-count"><i class="fa fa-comments-o"></i>' . $comment_link . "</span>"; // WPCS: XSS OK. }
function mb_entry_date_auth() { ob_start(); the_author_posts_link(); echo '<div class="entry-date-auth"> <time class="updated" datetime="' . get_the_time('c') . '">' . sprintf(__('%s', 'mb'), get_the_date()) . '</time>' . __(' By ', 'responsive-brix') . ob_get_clean() . '</div>'; }
function x_google_authorship_meta() { $author = sprintf('%s', get_the_author()); $title = sprintf('%s', get_the_title()); $date = sprintf('<time class="entry-date updated" datetime="%1$s">%2$s</time>', esc_attr(get_the_date('c')), esc_html(get_the_date('m.d.Y'))); printf('<span class="visually-hidden">%1$s%2$s%3$s</span>', '<span class="author vcard"><span class="fn">' . $author . '</span></span>', '<span class="entry-title">' . $title . '</span>', $date); }
function thirdrail_entry_meta() { echo '<div class="entry-meta">'; echo '<p class="byline"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" rel="author" class="author">' . get_the_author() . '</a>' . cats() . '</p>'; echo '<time class="updated date" datetime="' . get_the_time('c') . '">' . sprintf(__('%s', 'thirdrail'), get_the_date()) . '</time>'; echo '</div>'; }
function widget($args, $instance) { global $post; // Preserve global $post $preserve = $post; extract($args); // only useful on post pages if (!is_single()) { return; } $title = apply_filters('widget_title', empty($instance['title']) ? __('Read Next', 'largo') : $instance['title'], $instance, $this->id_base); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $related = new Largo_Related($instance['qty']); //get the related posts $rel_posts = new WP_Query(array('post__in' => $related->ids(), 'nopaging' => 1, 'posts_per_page' => $instance['qty'], 'ignore_sticky_posts' => 1)); if ($rel_posts->have_posts()) { echo '<ul class="related">'; while ($rel_posts->have_posts()) { $rel_posts->the_post(); echo '<li>'; echo '<a href="' . get_permalink() . '"/>' . get_the_post_thumbnail(get_the_ID(), 'thumbnail', array('class' => 'alignleft')) . '</a>'; ?> <h4><a href="<?php the_permalink(); ?> " title="Read: <?php esc_attr(the_title('', '', FALSE)); ?> "><?php the_title(); ?> </a></h4> <h5 class="byline"> <span class="by-author"><?php largo_byline(true, true); ?> </span> <time class="entry-date updated dtstamp pubdate" datetime="<?php echo esc_attr(get_the_date('c')); ?> "><?php largo_time(); ?> </time> </h5> <?php // post excerpt/summary largo_excerpt(get_the_ID(), 2, false, '', true); echo '</li>'; } echo "</ul>"; } echo $after_widget; // Restore global $post wp_reset_postdata(); $post = $preserve; }
function post_meta() { ?> <ul class="post_meta"> <li class="date"><?php echo get_the_date(); ?> </li> <li class="category"><?php the_category(', '); ?> </li> <?php $post_tags = wp_get_post_tags($post->ID); if (!empty($post_tags)) { ?> <li class="tags"><?php the_tags('', ', ', ''); ?> </li> <?php } ?> </ul><!-- .post-meta --> <?php }
function roots_entry_meta() { echo '<div id="author-info">'; echo '<time class="updated" datetime="' . get_the_time('c') . '" pubdate>' . sprintf(__('Posted on %s at %s.', 'roots'), get_the_date(), get_the_time()) . '</time>'; echo '<p class="byline author vcard">' . __('Written by', 'roots') . ' <a href="' . get_author_posts_url(get_the_author_meta('id')) . '" rel="author" class="fn">' . get_the_author() . '</a></p>'; echo '</div>'; }
/** * Prints HTML with meta information for the current post-date/time and author. */ function ushipnetwork_posted_on() { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if (get_the_time('U') !== get_the_modified_time('U')) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>'; } $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date())); $posted_on = sprintf(esc_html_x('%s', 'post date', 'ushipnetwork'), $time_string); $byline = sprintf(esc_html_x('by %s', 'post author', 'ushipnetwork'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>'); echo '<div class="posted-on">' . $posted_on . '<div class="share">'; include "share.php"; echo '</div>' . '</div>'; echo '<div class="byline">' . '<div class="authorship">' . $byline . '</div>'; $posttags = get_the_tags(); $count = 0; $separator = ', '; $output = ''; if (!empty($posttags)) { echo '<span class="tag-list">tags: '; foreach ($posttags as $posttag) { $count++; if ($count <= 2) { $output .= '<a href="' . esc_url(get_tag_link($posttag->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'textdomain'), $posttag->name)) . '">' . esc_html($posttag->name) . '</a>' . $separator; } } echo trim($output, $separator); } echo '</span>' . '</div>'; }
function header_meta() { ?> <div class="post-date"> <time datetime="<?php echo get_the_date('c'); ?> " pubdate> <span> <?php echo get_the_date('M'); ?> </span> <span> <?php echo get_the_date('d'); ?> </span> <span> <?php echo get_the_date('Y'); ?> </span> </time> </div><!-- /.entry-meta --> <?php }
function swv_default_title($title) { if (empty($title) && in_array(get_post_type(), array('post', 'page', 'attachment'))) { $title = get_the_date(); } return $title; }
/** * Prints HTML with meta information for the current post-date/time and author. */ function jkl_index_posted_on() { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if (get_the_time('U') !== get_the_modified_time('U')) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; } $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date())); $byline = sprintf(esc_html('%s'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">@' . esc_html(get_the_author()) . '</a></span>'); if ('chat' === get_post_format() || 'image' === get_post_format() || 'gallery' === get_post_format() || 'audio' === get_post_format() || 'video' === get_post_format()) { $string = ucwords(get_post_format()); $posted_on = $string . ': <a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>'; } else { $posted_on = sprintf(esc_html_x('Date: %s', 'post date', 'jkl'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>'); } $meta_class = is_single() ? 'format-small-meta' : 'meta-content-index'; echo '<div class="' . $meta_class . '">'; echo '<span class="posted-on">' . $posted_on . '</span>'; // WPCS: XSS OK. if (is_single()) { echo '<span class="byline">' . $byline . '</span>'; if (!has_post_format('quote')) { jkl_better_taxonomy_listing('category', 1); } } echo '</div><!-- .meta-content-index -->'; }
/** * Page titles */ function pinnacle_title() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Latest Posts', 'pinnacle'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return $term->name; } elseif (is_post_type_archive()) { return get_queried_object()->labels->name; } elseif (is_day()) { return sprintf(__('Daily Archives: %s', 'pinnacle'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'pinnacle'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'pinnacle'), get_the_date('Y')); } elseif (is_author()) { return sprintf(__('Author Archives: %s', 'pinnacle'), get_the_author()); } else { return single_cat_title("", false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'pinnacle'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'pinnacle'); } else { return get_the_title(); } }
/** * Loop tag * Shows posts for a given tag * Usage: [corenominal-loop-tag tag=foo per_page=30] */ function corenominal_shortcode_loop_tag($atts, $content = null) { $atts = shortcode_atts(array('tag' => 'foo', 'per_page' => 30), $atts); // WP_Query arguments $args = array('post_type' => array('post'), 'post_status' => array('publish'), 'tag' => $atts['tag'], 'posts_per_page' => $atts['per_page'], 'order' => 'DESC'); // The Query $query = new WP_Query($args); $data = ''; if ($query->have_posts()) { $data .= '<h3>Related Posts</h3>'; $data .= '<ul class="related-posts">'; while ($query->have_posts()) { $query->the_post(); $data .= '<li>'; $data .= '<span>' . get_the_date('Y-m-d') . '</span> '; $data .= '<a href="' . get_the_permalink() . '">'; $data .= get_the_title(); $data .= '</a>'; $data .= '</li>'; } $data .= '</ul>'; } wp_reset_postdata(); return $data; }
/** DistinctPress Post Date */ function distinctpress_post_date() { $post_date = esc_html(get_the_date()) . " " . esc_attr(get_the_time()); /** Output */ $output = sprintf('<span class="entry-date" title="%1$s"><a href="%2$s" title="%3$s" rel="bookmark"><i class="el-icon-time-alt meta-icon"></i>%1$s</a></span>', $post_date, esc_url(get_permalink()), the_title_attribute('echo=0')); return $output; }
function airballoon_display_postmeta() { ?> <span class="meta-date"> <?php printf('<a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s">%4$s</time></a>', esc_url(get_permalink()), esc_attr(get_the_time()), esc_attr(get_the_date('c')), esc_html(get_the_date())); ?> </span> <span class="meta-author"> <?php printf('<a href="%1$s" title="%2$s" rel="author">%3$s</a>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'airballoon-lite'), get_the_author())), get_the_author()); ?> </span> <?php if (comments_open()) { ?> <span class="meta-comments"> <?php comments_popup_link(__('Leave a comment', 'airballoon-lite'), __('One comment', 'airballoon-lite'), __('% comments', 'airballoon-lite')); ?> </span> <?php } edit_post_link(__('Edit Post', 'airballoon-lite')); }
static function ago() { $date = time() - strtotime(get_the_date("Y/n/j H:i:s", get_the_ID())); $date = intval($date / 60); //Mins $verb = $date == 1 ? "min" : "mins"; if ($date > 60) { $date = intval($date / 60); //Hours $verb = $date == 1 ? "hour" : "hours"; if ($date > 24) { $date = intval($date / 24); //Days $verb = $date == 1 ? "day" : "days"; if ($date > 30) { $days = $date; $date = intval($date / 30); //Months $verb = $date == 1 ? "month" : "months"; if ($date > 12) { $date = intval($days / 365); //Years $verb = $date == 1 ? "year" : "years"; } } } } return $date . " " . $verb . " ago"; }
function oxy_shortcode_recent($atts, $content = '') { // setup options extract(shortcode_atts(array('count' => 4, 'categories' => null, 'authors' => null, 'post_formats' => null, 'titles' => 'show'), $atts)); $categories = null === $categories ? null : explode(',', $categories); $authors = null === $authors ? null : explode(',', $authors); $post_formats = null === $post_formats ? null : explode(',', $post_formats); $posts = oxy_get_recent_posts($count, $categories, $authors, $post_formats); $output = ''; if (!empty($posts)) { $output .= '[raw]<ul class="oxyrecentposts">'; global $post; foreach ($posts as $post) { setup_postdata($post); $output .= '<li>'; $output .= '<a href="' . get_permalink() . '" class="recent-feature" >'; if (has_post_thumbnail($post->ID)) { $output .= get_the_post_thumbnail($post->ID, array(64, 64), array('title' => $post->post_title, 'alt' => $post->post_title)); } else { // $output .= oxy_theme_icon( oxy_get_post_icon( $post->ID ), 'span' ); } $output .= '</a>'; if ('show' == $titles) { $output .= '<h5>' . get_the_title($post->ID) . '</h5>'; $output .= '<p>' . get_the_date() . '</p>'; } $output .= '</li>'; } $output .= '</ul>[/raw]'; } // reset post data wp_reset_postdata(); return $output; }
/** * Page titles */ function roots_title() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Most Recent Posts', 'roots'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { return sprintf(__('Old Posts, Organized by Day: %s', 'roots'), get_the_date()); } elseif (is_month()) { return sprintf(__('Old Posts, Organized by Month: %s', 'roots'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Old Posts, Organized by Year: %s', 'roots'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('Old Posts, Organized by Author: %s', 'roots'), apply_filters('the_author', is_object($author) ? $author->display_name : null)); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'roots'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'roots'); } else { return get_the_title(); } }
/** * Latest blog posts * * @param int $limit post display limit * * @param string $thumbnail_size * * @return array */ public static function getRecent($limit = 10, $thumbnail_size = 'thumbnail') { $args = array('numberposts' => $limit, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending', 'suppress_filters' => true); $array_out = array(); $recent_posts = \get_posts(\wp_parse_args($args)); /*$like_bool = Option::get_theme_option( 'blog_list_like' ); if ( $like_bool === '1' ) { $PostLike = \SilverWp\Ajax\PostLike::getInstance(); }*/ foreach ($recent_posts as $key => $recent) { \setup_postdata($recent); $post_id = $recent->ID; //$array_out[ $key ] = $recent; $array_out[$key]['ID'] = $post_id; $array_out[$key]['post_title'] = \get_the_title($post_id); $array_out[$key]['url'] = \get_the_permalink($post_id); $array_out[$key]['post_author'] = \get_the_author(); $array_out[$key]['post_date'] = \get_the_date('', $post_id); $array_out[$key]['post_date_utc'] = \get_the_time('c', $post_id); //$array_out[ $key ]['post_like'] = ($like_bool === '1') ? $PostLike->getPostLikeCount($post_id) : ''; $array_out[$key]['post_comment_count'] = $recent->comment_count; if (strpos($recent->post_content, '<!--more-->') || empty($recent->post_excerpt)) { $array_out[$key]['post_excerpt'] = \get_the_excerpt(); } else { $array_out[$key]['post_excerpt'] = $recent->post_excerpt; } $array_out[$key]['image_html'] = \get_the_post_thumbnail($post_id, $thumbnail_size); // Thumbnail $array_out[$key]['categories'] = self::getTaxonomy($post_id); } \wp_reset_postdata(); return $array_out; }
function matraman_lite_date() { global $post; echo '<span class="date">'; echo get_the_date(); echo '</span>'; }
function appointment_aside_meta_content() { $appointment_options = theme_setup_data(); $news_setting = wp_parse_args(get_option('appointment_options', array()), $appointment_options); if ($news_setting['home_meta_section_settings'] == '') { ?> <!--show date of post--> <aside class="blog-post-date-area"> <div class="date"><?php echo get_the_date('j'); ?> <div class="month-year"><?php echo get_the_date('M'); ?> ,<?php echo get_the_date('Y'); ?> </div></div> <div class="comment"><a href="<?php the_permalink(); ?> "><i class="fa fa-comments"></i><?php comments_number('0', '1', '%'); ?> </a></div> </aside> <?php } }
/** * create_export_customers_tool. * * @version 2.3.9 * @since 2.3.9 */ function create_export_customers_tool() { $html = ''; $html .= '<pre>'; $html .= __('Nr.', 'woocommerce-jetpack') . ',' . __('Email', 'woocommerce-jetpack') . ',' . __('First Name', 'woocommerce-jetpack') . ',' . __('Last Name', 'woocommerce-jetpack') . ',' . __('Order Date', 'woocommerce-jetpack') . PHP_EOL; $total_customers = 0; $orders = array(); $offset = 0; $block_size = 96; while (true) { $args_orders = array('post_type' => 'shop_order', 'post_status' => 'any', 'posts_per_page' => $block_size, 'orderby' => 'date', 'order' => 'DESC', 'offset' => $offset); $loop_orders = new WP_Query($args_orders); if (!$loop_orders->have_posts()) { break; } while ($loop_orders->have_posts()) { $loop_orders->the_post(); $order_id = $loop_orders->post->ID; $order = wc_get_order($order_id); if (isset($order->billing_email) && '' != $order->billing_email && !in_array($order->billing_email, $orders)) { $emails_to_skip = array(); if (!in_array($order->billing_email, $emails_to_skip)) { $total_customers++; $html .= $total_customers . ',' . $order->billing_email . ',' . $order->billing_first_name . ',' . $order->billing_last_name . ',' . get_the_date('Y/m/d') . PHP_EOL; $orders[] = $order->billing_email; } } } $offset += $block_size; } $html .= '</pre>'; echo $html; }
function t_manage_columns($column, $post_id) { global $post; switch ($column) { case 'name': printf(get_post_meta($post_id, 'telegram_name', true)); break; case 'first_name': printf(get_post_meta($post_id, 'telegram_first_name', true)); break; case 'last_name': printf(get_post_meta($post_id, 'telegram_last_name', true)); break; case 'username': printf(get_post_meta($post_id, 'telegram_username', true)); break; case 'isadmin': break; case 'sdate': printf(get_the_date()); break; default: break; } }
function bl_posttype_shortcodes_showposts($params = array()) { // Pulls the paramater values passed from the shortcode options extract(shortcode_atts(array('post_type' => 'post', 'post_status' => 'publish', 'offset' => 0, 'posts_per_page' => ''), $params)); // Builds the query based on the available params $query = new WP_Query(array('post_type' => $post_type, 'post_status' => $post_status, 'offset' => $offset, 'posts_per_page' => $posts_per_page)); // Looks for the presence of any qualifying posts inside the defined loop if ($query->have_posts()) { // We open the post container only where specified posts are available $shortcodeOutput = '<div>'; while ($query->have_posts()) { $query->the_post(); // Wraps each qualifying post for output in an <article> tag with Schema data. $shortcodeOutput .= '<article itemscope itemtype="http://schema.org/Article">'; $shortcodeOutput .= '<a href="' . get_the_permalink() . '">'; $shortcodeOutput .= '<h3 itemprop="name">' . get_the_title() . '</h3>'; $shortcodeOutput .= '</a>'; $shortcodeOutput .= '<time itemprop="dateCreated">' . get_the_date() . '</time>'; $shortcodeOutput .= '<em itemprop="author">' . get_the_author() . '</em>'; $shortcodeOutput .= '<div itemprop="description">' . get_the_excerpt() . '</div>'; $shortcodeOutput .= '<article>'; } // Closes off the parent container $shortcodeOutput .= '</div>'; } // Resets the wordpress loop wp_reset_postdata(); // Returns the concatenated shortcodeOutput to the page return $shortcodeOutput; }
function appointment_aside_meta_content() { $current_options = get_option('appointment_options'); if ($current_options['meta_section_settings'] == 'on') { ?> <!--show date of post--> <aside class="blog-post-date-area"> <div class="date"><?php echo get_the_date('j'); ?> <div class="month-year"><?php echo get_the_date('M'); ?> ,<?php echo get_the_date('Y'); ?> </div></div> <div class="comment"><a href="<?php the_permalink(); ?> "><i class="fa fa-comments"></i><?php comments_number('', 'o', '%'); ?> </a></div> </aside> <?php } }
function twentyten_posted_on() { $meta = array(); $meta['author'] = sprintf(__('%1$s <span class="meta-sep">by</span> %2$s', 'wordcampbase'), sprintf('<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>', get_permalink(), esc_attr(get_the_time()), get_the_date()), sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>', get_author_posts_url(get_the_author_meta('ID')), sprintf(esc_attr__('View all posts by %s', 'wordcampbase'), get_the_author()), get_the_author())); $meta['sep'] = ' <span class="meta-sep meta-sep-bull">•</span> '; $meta['comments'] = array('before' => '<span class="comments-link">', 'after' => '</span>', 'zero' => __('Leave a comment', 'wordcampbase'), 'one' => __('1 Comment', 'wordcampbase'), 'many' => __('% Comments', 'wordcampbase')); $meta['edit'] = array('title' => __('Edit', 'wordcampbase'), 'before' => '<span class="edit-link">', 'after' => '</span>'); $meta['br'] = '<br />'; // Just to have. $meta['order'] = array('author', 'sep', 'comments', 'edit'); $meta = apply_filters('wcb_entry_meta', $meta); if (!is_array($meta) || !isset($meta['order'])) { return; } foreach ($meta['order'] as $type) { $content = $meta[$type]; switch ($type) { case 'comments': echo $content['before']; comments_popup_link($content['zero'], $content['one'], $content['many']); echo $content['after']; break; case 'edit': if (isset($meta['sep'])) { $content['before'] = $meta['sep'] . $content['before']; } edit_post_link($content['title'], $content['before'], $content['after']); break; default: echo $content; } } }
/** * Page titles */ function stachestack_title() { if (is_home()) { if (get_option('page_for_posts', true)) { $title = get_the_title(get_option('page_for_posts', true)); } else { $title = __('Latest Posts', 'stachestack'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { $title = apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { $title = apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { $title = sprintf(__('Daily Archives: %s', 'stachestack'), get_the_date()); } elseif (is_month()) { $title = sprintf(__('Monthly Archives: %s', 'stachestack'), get_the_date('F Y')); } elseif (is_year()) { $title = sprintf(__('Yearly Archives: %s', 'stachestack'), get_the_date('Y')); } elseif (is_author()) { $title = sprintf(__('Author Archives: %s', 'stachestack'), get_queried_object()->display_name); } else { $title = single_cat_title('', false); } } elseif (is_search()) { $title = sprintf(__('Search Results for %s', 'stachestack'), get_search_query()); } elseif (is_404()) { $title = __('Not Found', 'stachestack'); } else { $title = get_the_title(); } return apply_filters('stachestack_title', $title); }
/** * Prints HTML with meta information for the current post-date/time, author, comment count and categories. */ function ultra_posted_on() { echo '<div class="entry-meta-inner">'; if (is_sticky() && is_home() && !is_paged()) { echo '<span class="featured-post">' . __('Sticky', 'ultra') . '</span>'; } if (is_home() && siteorigin_setting('blog_post_date') || is_archive() && siteorigin_setting('blog_post_date') || is_search() && siteorigin_setting('blog_post_date')) { echo '<span class="entry-date"><a href="' . esc_url(get_permalink()) . '" rel="bookmark"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span></a>'; } if (is_single() && siteorigin_setting('blog_post_date')) { echo '<span class="entry-date"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span>'; } if (siteorigin_setting('blog_post_author')) { echo '<span class="byline"><span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" rel="author">' . esc_html(get_the_author()) . '</a></span></span>'; } if (comments_open() && siteorigin_setting('blog_post_comment_count')) { echo '<span class="comments-link">'; comments_popup_link(__('Leave a comment', 'ultra'), __('1 Comment', 'ultra'), __('% Comments', 'ultra')); echo '</span>'; } echo '</div>'; if (is_single() && siteorigin_setting('navigation_post_nav')) { the_post_navigation($args = array('prev_text' => '', 'next_text' => '')); } }
function widget($args, $instance) { global $post; extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? __('Recent Posts', 'lan-thinkupthemes') : apply_filters('widget_title', $instance['title']); if (!empty($title)) { echo $before_title . $title . $after_title; } $posts = new WP_Query('orderby=date&posts_per_page=' . $instance['postcount'] . ''); while ($posts->have_posts()) { $posts->the_post(); // Insert post date if needed. if ($instance['postdate'] == 'on') { $date_input = '<a href="' . get_permalink() . '" class="date">' . get_the_date('M j, Y') . '</a>'; } // HTML output echo '<div class="recent-posts">'; if (has_post_thumbnail() and $instance['imageswitch'] == 'on') { echo '<div class="image">', '<a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_post_thumbnail($post->ID, array(65, 65)) . '<div class="image-overlay"></div></a>', '</div>', '<div class="main">', '<a href="' . get_permalink() . '">' . get_the_title() . '</a>', $date_input, '</div>'; } else { echo '<div class="main">', '<a href="' . get_permalink() . '">' . get_the_title() . '</a>', $date_input, '</div>'; } echo '</div>'; } wp_reset_query(); echo $after_widget; }