function shaped_blog_posted_on() { ?> <ul class="list-inline"> <li> <span class="author vcard"> <?php _e('By ', 'shaped-blog'); printf('<a class="url fn n" href="%1$s">%2$s</a>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_html(get_the_author())); ?> </span> </li> <li> on <span class="posted-on"><?php the_time('M d, Y'); ?> </span> </li> <?php if (get_the_category_list()) { ?> <li> in <span class="posted-in"> <?php echo get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'shaped-blog')); ?> </span> </li> <?php } ?> </ul> <?php }
function widget($args, $instance) { extract($args); @($title = $instance['title'] ? $instance['title'] : '最热文章'); @($num = $instance['num'] ? $instance['num'] : 5); echo $before_widget; ?> <div class="panel panel-zan hidden-xs"> <div class="panel-heading"><?php echo $title; ?> </div> <div class="panel-body"> <ul class="list-group"> <?php // 设置全局变量,实现post整体赋值 global $post; $posts = zan_get_hotest_posts($num); foreach ($posts as $post) { setup_postdata($post); ?> <li class="zan-list clearfix"> <figure class="thumbnail zan-thumb"> <?php the_post_thumbnail(array(75, 75)); ?> </figure> <a href="<?php the_permalink(); ?> "> <h5><?php the_title(); ?> </h5> </a> <div class="sidebar-info"> <span><i class="fa fa-calendar"></i> <?php the_time('m月j日, Y'); ?> </span> <span><i class="fa fa-comment"></i> <a href="<?php the_permalink(); ?> #comments"><?php comments_number('0', '1', '%'); ?> </a></span> </div> </li> <?php } wp_reset_postdata(); ?> </ul> </div> </div> <?php echo $after_widget; }
function get_news_ticker($tickercat, $count) { global $post; $args = array('posts_per_page' => $count, 'cat' => $tickercat); $loop = new WP_Query($args); echo "<ul>"; while ($loop->have_posts()) { $loop->the_post(); ?> <li class="ticker-item"> <b><?php the_time('M j, Y'); ?> </b> - <a href="<?php the_permalink(); ?> "> <?php the_title(); ?> </a> </li> <?php } echo "</ul>"; wp_reset_postdata(); }
function rambo_post_meta_content() { ?> <div class="blog_section2_comment"> <a href="<?php the_permalink(); ?> "><i class="fa fa-calendar icon-spacing"></i><?php the_time(get_option('date_format')); ?> </a> <a href="<?php the_permalink(); ?> "><i class="fa fa-comments icon-spacing"></i><?php comments_popup_link(__('leave a comment', 'rambo')); ?> </a> <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?> "><i class="fa fa-user icon-spacing"></i> <?php _e("By", 'rambo'); ?> <?php the_author(); ?> </a> </div> <?php }
function post_excerpts_here() { //posts with date, author, time, content excerpts, and title.. if (have_posts()) { while (have_posts()) { echo '<div class="excerpt-div">'; the_post(); echo '<h2 class="post-title"><a href="'; the_permalink(); echo '" title="'; the_title(); echo '">'; the_title(); echo '</a></h2>'; echo '<h4 class="post-info">'; echo 'Created on '; the_date(); echo ' at '; the_time(); echo ' by '; the_author_meta(first_name); echo '.</h4>'; echo '<p class="post-excerpt">'; the_excerpt(); echo '</p>'; echo '</div>'; } // end while } // end if }
/** * Display common postmeta information. The parent theme originally showed * date, author, and a comment link. */ function webonary_zeedisplay_display_entry_header() { $options = get_option('themezee_options'); if (isset($options['themeZee_blog_mode']) and $options['themeZee_blog_mode'] == BLOG_MODE) { ?> <div class="postmeta"> <span class="date"><a href="<?php the_permalink(); ?> "><?php the_time(get_option('date_format')); ?> </a></span> <span class="author"><?php the_author(); ?> </span> <span class="comment"><a href="<?php the_permalink(); ?> #comments"><?php comments_number(__('No comments', ZEE_LANG), __('One comment', ZEE_LANG), __('% comments', ZEE_LANG)); ?> </a></span> </div> <?php } }
/** * Prints HTML with meta information for the current post-date/time and author. */ function totomo_posted_on() { // Default info will be shown $post_format = get_post_format(get_the_ID()); ?> <ul class="post-meta clearfix"> <li> <time class="date fa fa-clock-o" datetime="<?php the_time('c'); ?> " pubdate><?php the_time(get_option('date_format')); ?> </time> </li> <li> <?php comments_popup_link(__('No Comments', 'totomo'), __('1 Comment', 'totomo'), __('% Comments', 'totomo'), 'comments-link fa fa-comments'); ?> </li> <li class="fa fa-tags"> <?php the_category(', '); ?> </li> </ul> <?php }
function categori_news(){ query_posts('cat=9&showposts=10&posts_per_page=3'); while (have_posts()) : the_post(); /*Dima insert*/the_excerpt(); ?> <div class="content-box"> <div class="bgr01"><div class="bgr02"><div class="bgr03"> <div <?php post_class() ?> id="post-<?php the_ID(); ?>" style=" float:none; "> <div class="title"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <div class="date_all"> <?php the_time('l, j ?F, Y') ?> </div> <div class="post"> Написал <?php the_author_link() ?> <?php the_time('g:i A') ?> </div> </div> <div class="content_box"> <?php the_content('Читать всё'); ?> </div> <div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div> <div class="comments"><?php comments_popup_link('0 комментарии', 'комментарии', '% комментарии '); ?></div> <div class="link-edit"><?php edit_post_link('Edit', ''); ?></div> </div> </div></div></div> </div> <?php endwhile;}
function woo_widget_tabs_latest($posts = 5, $size = 45) { global $post; $latest = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'post_date', 'order' => 'desc', 'numberposts' => $posts)); foreach ($latest as $post) { setup_postdata($post); ?> <li> <?php if ($size != 0) { woo_image('height=' . $size . '&width=' . $size . '&class=thumbnail&single=true'); } ?> <a title="<?php the_title_attribute(); ?> " href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> <span class="meta"><?php the_time(get_option('date_format')); ?> </span> <div class="fix"></div> </li> <?php } wp_reset_postdata(); }
echo "</div>"; } function _post() { ?> <!-- POSTS --> <div class="post"> <div class="posthead"> <span class="date"> <?php the_time('d/m/Y'); ?> </span><!-- /date --> <span class="autor"> <?php the_author_posts_link(); ?> </span> <?php //the_category(" | ") ?> </div><!-- /headpost --> <div class="postcontent"> <h1><a href="<?php the_permalink(); ?> " title="<?php the_title();
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="post-list"> <?php query_posts('post_type=post&posts_per_page=' . $instance['amount'] . '&orderby=comment_count&order=DESC'); if (have_posts()) { while (have_posts()) { the_post(); ?> <li> <figure class="frame pull-left"> <div class="icon-overlay"><a href="<?php the_permalink(); ?> "><span class="icn-more"></span><?php the_post_thumbnail('thumbnail'); ?> </a></div> </figure> <div class="meta"> <em><span class="date"><?php the_time(get_option('date_format')); ?> </span> <span class="comments"><a href="<?php comments_link(); ?> "><?php comments_number('0', '1', '%'); ?> <i class="icon-chat-1"></i></a></span></em> <h5><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h5> </div> </li> <?php } } wp_reset_query(); ?> </ul> <?php echo $after_widget; }
function b_wp_contents_show($options) { // global $xoopsDB,$xoopsUser; // global $tableoptions,$tableusers; // global $id, $posts, $post, $day, $previousday, $newday; $id = 1; global $posts, $post, $day, $previousday, $newday; global $dateformat, $time_difference, $siteurl, $blogfilename; global $tablelinks, $tablelinkcategories; global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week; global $tableposts, $tablepost2cat, $tablecomments, $tablecategories; global $smilies_directory, $use_smilies, $wp_smiliessearch, $wp_smiliesreplace; global $wp_bbcode, $use_bbcode, $wp_gmcode, $use_gmcode, $use_htmltrans, $wp_htmltrans, $wp_htmltranswinuni; require_once dirname(__FILE__) . '/../wp-blog-header.php'; $blog = 1; $block = array(); $block['siteurl'] = $siteurl; foreach ($posts as $post) { $content = array(); start_wp(); $content['date'] = the_date('', '<h2>', '</h2>', false); $content['time'] = the_time('', false); $content['title'] = the_title('', '', false); $content['permlink'] = get_permalink(); // ob_start(); the_author(); $content['author'] = ob_get_contents(); ob_end_clean(); // ob_start(); the_category(); $content['category'] = ob_get_contents(); ob_end_clean(); // ob_start(); the_content(); $content['body'] = ob_get_contents(); ob_end_clean(); // ob_start(); link_pages('<br />Pages: ', '<br />', 'number'); $content['linkpage'] = ob_get_contents(); ob_end_clean(); // ob_start(); comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)'); $content['comments'] = ob_get_contents(); ob_end_clean(); // ob_start(); trackback_rdf(); $content['trackback'] = ob_get_contents(); ob_end_clean(); // $block['contents'][] = $content; } return $block; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? 'Popular This Week' : $instance['title']); $postsNum = empty($instance['postsNum']) ? '' : (int) $instance['postsNum']; $show_thisweek = isset($instance['thisweek']) ? (bool) $instance['thisweek'] : false; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $additional_query = $show_thisweek ? '&year=' . date('Y') . '&w=' . date('W') : ''; query_posts('post_type=post&posts_per_page=' . $postsNum . '&orderby=comment_count&order=DESC' . $additional_query); ?> <?php if (have_posts()) { while (have_posts()) { the_post(); ?> <div class="blog-entry"> <a href="<?php the_permalink(); ?> " class="comments"><?php comments_number('0', '1', '%'); ?> </a> <h4 class="title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h4> <p class="meta-info"><?php esc_html_e('Posted', 'Aggregate'); ?> <?php esc_html_e('by', 'Aggregate'); ?> <?php the_author_posts_link(); ?> <?php esc_html_e('on', 'Aggregate'); ?> <?php the_time('n-j-y'); ?> </p> </div> <?php } } wp_reset_query(); ?> <?php echo $after_widget; }
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); //these are our widget options $title = $instance['title']; $count = $instance['count']; //get recent posts query_posts(array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'order' => 'DESC')); echo $before_widget; ?> <div class="clearfix"> <div class="header_left"> <?php if ($title) { echo $before_title . $title . $after_title; } ?> </div> <div class="header_right"> <a href="#" id="footer_recent_posts_prev" class="scrolling_list_control_left icon_small_arrow left_white"></a> <a href="#" id="footer_recent_posts_next" class="scrolling_list_control_right icon_small_arrow right_white"></a> </div> </div> <div class="scrolling_list_wrapper"> <ul class="scrolling_list footer_recent_posts"> <?php if (have_posts()) { while (have_posts()) { the_post(); ?> <li class="icon_small_arrow right_white"> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <?php the_title(); ?> </a> <abbr title="<?php the_time('c'); ?> " class="timeago"><?php the_time('c'); ?> </abbr> </li> <?php } } ?> </ul> </div> <?php echo $after_widget; }
function bfa_parse_date_callback($matches) { ob_start(); the_time($matches[2]); $date = ob_get_contents(); ob_end_clean(); return $date; }
function html5_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <article <?php comment_class(); ?> id="comment-<?php comment_ID(); ?> "> <header class="comment-author vcard"> <?php echo get_avatar($comment, $size = '48', $default = '<path_to_url>'); ?> <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()); ?> </header> <?php if ($comment->comment_approved == '0') { ?> <em><?php _e('Your comment is awaiting moderation.'); ?> </em> <?php } ?> <div class="comment-meta commentmetadata"><time datetime="<?php the_time('Y-m-d'); ?> " pubdate><a href="<?php echo htmlspecialchars(get_comment_link($comment->comment_ID)); ?> "><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()); ?> </a></time><?php edit_comment_link(__('(Edit)'), ' ', ''); ?> </div> <?php comment_text(); ?> <div class="reply"> <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </div> <?php }
/** * [UNFINISHED] Generates a breadcrumb or the current page. * * @return string The breadcrumb HTML */ function get_the_breadcrumb() { global $post; $str = '<ul id="breadcrumbs">'; if (!is_home()) { $str .= sprintf('<li><a href="%1$s">Home</a></li><li class="separator"> / </li>', home_url('/')); if (is_category() || is_single()) { $categories = get_the_category(); if ($categories) { $cats = array(); foreach (array_slice($categories, 0, 3) as $category) { $cats[] = sprintf('<li><a href="%1$s">%2$s</a></li>', get_category_link($category->term_id), $category->cat_name); } $str .= implode('<li class="separator"> / </li>', $cats); } if (is_single()) { $str .= '<li class="separator"> / </li><li>' . get_the_title() . '</li>'; } } elseif (is_page()) { if ($post->post_parent) { $anc = get_post_ancestors($post->ID); $title = get_the_title(); foreach ($anc as $ancestor) { $output = '<li><a href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li> <li class="separator">/</li>'; } $str .= $output; $str .= '<strong title="' . $title . ' "> ' . $title . '</strong>'; } else { $str .= '<li><strong> ' . get_the_title() . '</strong></li>'; } } } elseif (is_tag()) { single_tag_title(); } elseif (is_day()) { $str .= "<li>Archive for "; the_time('F jS, Y'); $str .= '</li>'; } elseif (is_month()) { $str .= "<li>Archive for "; the_time('F, Y'); $str .= '</li>'; } elseif (is_year()) { $str .= "<li>Archive for "; the_time('Y'); $str .= '</li>'; } elseif (is_author()) { $str .= "<li>Author Archive"; $str .= '</li>'; } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { $str .= "<li>Blog Archives"; $str .= '</li>'; } elseif (is_search()) { $str .= "<li>Search Results"; $str .= '</li>'; } $str .= '</ul>'; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $category = $instance['category']; // create wp_query to get latest items $args = array('post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC', 'post_status' => 'publish', 'posts_per_page' => $instance["number"], 'ignore_sticky_posts' => 1); if ($category && $category != 0) { $args['tax_query'][] = array('taxonomy' => 'category', 'field' => 'ID', 'terms' => $category); } $th_query = null; $th_query = new WP_Query($args); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } echo '<ul class="widget-recent-post">'; if ($th_query->have_posts()) { while ($th_query->have_posts()) { $th_query->the_post(); ?> <li> <?php if ($instance['show_date'] != "no") { ?> <time datetime="<?php the_time('Y-m-d'); ?> " title="<?php the_time('Y-m-d'); ?> "><?php the_time(get_option('date_format')); ?> </time><br> <?php } ?> <a href="<?php the_permalink(); ?> " title="<?php printf(esc_attr__('Permalink to %s', 'editit'), the_title_attribute('echo=0')); ?> "><?php the_title(); ?> </a> </li> <?php } } wp_reset_query(); echo '</ul>'; echo $after_widget; }
function widget($args, $instance) { extract($args); //$options = get_option('custom_recent'); $title = $instance['title']; $postscount = $instance['posts']; //GET the posts global $postcount; $myposts = get_posts(array('orderby' => 'comment_count', 'numberposts' => $postscount)); //SHOW the posts ?> <div class = "sidebar-box"> <div class="sidebar-box"> <h4><?php echo $before_widget . $before_title . $title . $after_title; ?> </h4> <div class="sidebar-b"> <?php foreach ($myposts as $post) { setup_postdata($post); $feat_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); ?> <div class="sidebar-poppost"> <div class="sidebar-poppostimg"><img src="<?php echo $feat_image; ?> " alt="" class="img-responsive2"></div> <div class="sidebar-popposttitle"> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> <span>By <?php the_author(); ?> on <?php the_time('F j, Y'); ?> </span> </div> </div> <?php } echo $after_widget; ?> </div> </div> </div> <?php }
/** * @desc Output of the date * @author Georg Leciejewski */ function c_widget_date($args, $number = 1) { $options = get_option('c_widget_date'); $before_widget = stripslashes($options[$number]['before_widget']); $after_widget = stripslashes($options[$number]['after_widget']); echo $before_widget . "\n"; the_time('F jS, Y'); echo $after_widget . "\n"; }
/** * 相关页面 */ function wpdx_related_pages() { $orig_post = $post; global $post; $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach ($tags as $individual_tag) { $tag_ids[] = $individual_tag->term_id; } $args = array('post_type' => 'page', 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => 5); $my_query = new WP_Query($args); if ($my_query->have_posts()) { echo '<div id="relatedpages"><h3>相关页面</h3><ul>'; while ($my_query->have_posts()) { $my_query->the_post(); ?> <li> <div class="relatedthumb"><a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "> <?php the_post_thumbnail('thumb'); ?> </a></div> <div class="relatedcontent"> <h3><a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "> <?php the_title(); ?> </a></h3> <?php the_time('M j, Y'); ?> </div> </li> <?php } echo '</ul></div>'; } else { echo "没有相关页面"; } } $post = $orig_post; wp_reset_query(); }
function widget($args, $instance) { extract($args); ?> <?php echo $before_widget; ?> <?php if ($instance['title']) { echo $before_title . $instance['title'] . $after_title; } ?> <ul class="spy"> <?php query_posts(array('posts_per_page' => 5, 'orderby' => 'rand', 'caller_get_posts' => 1)); while (have_posts()) { the_post(); ?> <li><?php if (has_post_thumbnail()) { ?> <div class="img"><?php the_post_thumbnail('thumbnail', array('alt' => trim(strip_tags($post->post_title)), 'title' => trim(strip_tags($post->post_title)))); ?> </div><?php } ?> <h2><a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a></h2> <div class="fcats"><?php the_category(', '); ?> </div> <div class="fcats"><?php the_time('Y.m.d'); ?> </div> </li> <?php } wp_reset_query(); ?> </ul> <?php echo $after_widget; ?> <?php }
function agatha_breadcrumb() { global $post; echo '<ul id="trilha">'; if (!is_home()) { echo '<li><a href="'; echo get_option('home'); echo '">'; echo 'Página inicial'; echo '</a></li><li class="separador"> / </li>'; if (is_category() || is_single()) { echo '<li>'; the_category(' </li><li class="separador"> / </li><li> '); if (is_single()) { echo '</li><li class="separador"> / </li><li>'; the_title(); echo '</li>'; } } elseif (is_page()) { if ($post->post_parent) { $anc = get_post_ancestors($post->ID); $title = get_the_title(); foreach ($anc as $ancestor) { $output = '<li><a href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li> <li class="separador">/</li>'; } echo $output; echo '<strong title="' . $title . '"> ' . $title . '</strong>'; } else { echo '<li><strong> ' . get_the_title() . '</strong></li>'; } } } elseif (is_tag()) { single_tag_title(); } elseif (is_day()) { echo "<li>Arquivo de "; the_time('j \\d\\e F \\d\\e Y'); echo '</li>'; } elseif (is_month()) { echo "<li>Arquivo de "; the_time('F \\d\\e Y'); echo '</li>'; } elseif (is_year()) { echo "<li>Arquivo de "; the_time('Y'); echo '</li>'; } elseif (is_author()) { echo "<li>Arquivo do autor"; echo '</li>'; } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { echo "<li>Arquivo do blog"; echo '</li>'; } elseif (is_search()) { echo "<li>Resultados da pesquisa"; echo '</li>'; } echo '</ul>'; }
function the_breadcrumb() { global $post; echo '<ul id="breadcrumbs">'; if (!is_home()) { echo '<li><a href="'; echo get_option('home'); echo '">'; echo 'Home'; echo '</a></li><li class="separator"> / </li>'; if (is_category() || is_single()) { echo '<li>'; the_category(' </li><li class="separator"> / </li><li> '); if (is_single()) { echo '</li><li class="separator"> / </li><li>'; the_title(); echo '</li>'; } } elseif (is_page()) { if ($post->post_parent) { $anc = get_post_ancestors($post->ID); $title = get_the_title(); foreach ($anc as $ancestor) { $output = '<li><a href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li> <li class="separator">/</li>'; } echo $output; echo '<strong title="' . $title . '"> ' . $title . '</strong>'; } else { echo '<li><strong> ' . get_the_title() . '</strong></li>'; } } } elseif (is_tag()) { single_tag_title(); } elseif (is_day()) { echo "<li>Archive for "; the_time('F jS, Y'); echo '</li>'; } elseif (is_month()) { echo "<li>Archive for "; the_time('F, Y'); echo '</li>'; } elseif (is_year()) { echo "<li>Archive for "; the_time('Y'); echo '</li>'; } elseif (is_author()) { echo "<li>Author Archive"; echo '</li>'; } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { echo "<li>Blog Archives"; echo '</li>'; } elseif (is_search()) { echo "<li>Search Results"; echo '</li>'; } echo '</ul>'; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="post-list"> <?php $widget_query = new WP_Query(array('post_type' => 'post', 'orderby' => 'comment_count', 'order' => 'DESC', 'posts_per_page' => $instance['amount'])); if ($widget_query->have_posts()) { while ($widget_query->have_posts()) { $widget_query->the_post(); ?> <li> <figure class="overlay"> <a href="<?php the_permalink(); ?> "> <div class="overlay icon"> <div class="info"><span class="icon-more"></span></div> </div> <?php the_post_thumbnail('thumbnail'); ?> </a> </figure> <div class="post-content"> <div class="meta"><span class="date"><?php the_time(get_option('date_format')); ?> </span> </div> <p> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </p> </div> </li> <?php } } wp_reset_postdata(); ?> </ul> <?php echo $after_widget; }
function nm_home_tabs($cats, $width = 463, $height = 210) { $cats = explode(',', $cats); $cat = get_category_by_slug($cats[0]); $cat = get_category($cat->category_parent); echo '<div id="tab-instance-' . $cat->slug . '" class="tabs" style="width: ' . $width . 'px;"><ul class="tabs-nav">'; $class = ' class="tabs-nav-active"'; //Generate the nav from the cats foreach ($cats as $cat) { $cat = get_category_by_slug($cat); echo '<li><a id="a-' . $cat->slug . '"' . $class . ' href="javascript:show_home_tab(\'a-' . $cat->slug . '\')">' . $cat->name . '</a></li>'; $class = ''; } echo '</ul><div class="tabs-content" style="height: ' . $height . 'px;">'; foreach ($cats as $cat) { echo '<ul id="ul-' . $cat . '" class="tabs-content-ul">'; //Check if is older then 3 days, if is then order by rand $orderby = ''; query_posts('showposts=1&category_name=' . $cat); if (have_posts()) { while (have_posts()) { the_post(); $older = date('YMD'); $days_since = floor((date('U') - get_the_time('U')) / 86400); if ($days_since >= 4) { $orderby = '&orderby=rand'; } } } query_posts('showposts=5&category_name=' . $cat . $orderby); if (have_posts()) { while (have_posts()) { the_post(); global $post; echo '<li class="tabs-content-item"> <h4><a href="' . get_permalink() . '">' . $post->post_title . '</a></h4>' . '<a href="' . get_permalink() . '">' . article_image($post->ID, 'small', true) . '</a>'; echo '<p>'; wswwpx_content_extract('', '15', '15', 2, '', '', TRUE, FALSE); echo '</p>'; echo '<p class="tabs-content-meta">'; echo '<a href="' . get_permalink() . '">'; comments_number('No Comments', '1 Comment', '% Comments'); echo '</a> | Posted: '; the_time('l, F jS, Y'); echo ' | By: <a href="' . getProfileLink($post->post_author) . '">'; the_author(); echo '</a>'; echo '</p>'; echo '</li>'; } } echo '</ul>'; } echo '</div> </div>'; }
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $title = $instance['title']; $number = $instance['number']; /* Before widget (defined by themes). */ echo $before_widget; ?> <div class="widget recent-posts"> <h4 class="widget-title"><?php echo $title; ?> </h4> <ul> <?php $posts = new WP_Query(array('showposts' => $number, 'post_status' => 'publish', 'ignore_sticky_posts' => 1)); ?> <?php while ($posts->have_posts()) { $posts->the_post(); ?> <li> <i class="icon-rss icon"></i> <div class="post"> <a href="<?php echo get_permalink(); ?> "><?php the_title(); ?> </a> <i class="meta"><?php the_time('M j, Y'); ?> </i> </div> </li> <?php } ?> </ul> <?php wp_reset_query(); ?> </div> <?php /* After widget (defined by themes). */ echo $after_widget; }
function the_crumbs() { echo '<nav class="crumbs">现在位置: '; echo '<a title="返回首页" href="'; echo get_settings('home'); echo '">'; echo '首页'; echo "</a>"; if (is_category()) { echo ' > '; echo get_category_parents(get_query_var('cat'), true, ' > '); echo ' 文章 '; } if (is_single()) { echo ' > '; echo the_category(' > ', 'multiple'); echo ' > '; echo ' 正文 '; } if (is_page()) { echo ' > '; echo the_title(); } elseif (is_tag()) { echo ' > '; single_tag_title(); echo ' > 文章 '; } elseif (is_day()) { echo ' > '; echo "发表于"; the_time('Y年m月d日'); echo '的文章'; } elseif (is_month()) { echo ' > '; echo "发表于"; the_time('Y年m月'); echo '的文章'; } elseif (is_year()) { echo ' > '; echo "发表于"; the_time('Y年'); echo '的文章'; } elseif (is_author()) { echo ' > '; echo wp_title(''); echo '发表的文章'; } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { echo "Blog Archives"; echo ''; } elseif (is_search()) { echo ' > '; echo "搜索结果"; echo ''; } echo '</nav>'; }
function wcr_author_loop() { $args = array('author' => get_the_author_meta('ID'), 'orderby' => 'post_date', 'order' => 'DESC', 'posts_per_page' => '10'); $loop = new WP_Query($args); if ($loop->have_posts()) { // loop through posts while ($loop->have_posts()) { $loop->the_post(); ?> <article class="entry" itemprop="blogPost" itemtype="http://schema.org/BlogPosting" itemscope="itemscope"> <header class="entry-header"> <a href="<?php echo get_permalink(); ?> " title="<?php the_title(); ?> "> <h1 itemprop="headline"> <?php the_title(); ?> </h1> </a> <p class="entry-meta"> <?php the_time('l, F jS, Y'); echo ' by '; the_author(); ?> </header> <div class="author-blog entry-content"> <?php if (has_post_thumbnail()) { the_post_thumbnail('medium'); } ?> <?php the_excerpt(); ?> </div> <footer> Categories: <?php the_category(', '); ?> </footer> </article> <?php } } wp_reset_postdata(); }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="post-list"> <?php query_posts('post_type=post&posts_per_page=' . $instance['amount'] . '&orderby=comment_count&order=DESC'); if (have_posts()) { while (have_posts()) { the_post(); ?> <li> <div class="icon-overlay"> <a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail('thumbnail'); ?> </a> </div> <div class="meta"> <h6><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h6> <em><?php the_time(get_option('date_format')); ?> </em> </div> </li> <?php } } wp_reset_query(); ?> </ul> <?php echo $after_widget; }