本文整理汇总了PHP中the_category函数的典型用法代码示例。如果您正苦于以下问题:PHP the_category函数的具体用法?PHP the_category怎么用?PHP the_category使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_category函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatAttribute
function formatAttribute()
{
global $post;
?>
<ul class="post-in">
<li>
<?php
esc_html_e("Posted In : ", "charity");
the_category(" , ");
$tags = get_tags();
if (!empty($tags)) {
the_tags(" , ");
}
?>
</li>
<li>
<a href="<?php
comments_link();
?>
"><?php
comments_number('0 : comment', '1 : comment', '% : comments');
?>
</a>
</li>
</ul>
<?php
}
示例2: magnificient_entry_meta
function magnificient_entry_meta()
{
echo '<span class="byline author"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" rel="author" class="fn">' . get_the_author() . '</a> • </span>';
echo '<time class="updated" datetime="' . get_the_time('c') . '" pubdate><a href="' . get_permalink() . '">' . get_the_time('F jS, Y') . '</a> • </time>';
echo '<span class="entry-category">' . the_category('•') . '</span>';
echo '<span class="entry-tags">' . the_tags(' • ', ' • ', '') . '</span>';
}
示例3: foundationpress_entry_meta
function foundationpress_entry_meta()
{
echo '<div class="meta"><time class="updated" datetime="' . get_the_time('c') . '">' . sprintf(__('%s', 'foundationpress'), get_the_date(), get_the_time()) . '</time>';
echo ' | Published in: ';
the_category(', ');
echo '</div>';
}
示例4: blog_page_feed
function blog_page_feed()
{
$paged = get_query_var('paged', 1);
$args = array('posts_per_page' => 10, 'paged' => $paged);
$the_query = new WP_Query($args);
// TAILOR PAGER BEHAVIOR TO NUMBER OF POSTS
if ($the_query->found_posts <= 10) {
$pager_class = 'pager-div-collapse';
} else {
$pager_class = 'pager-div';
}
if ($the_query->have_posts()) {
while ($the_query->have_posts()) {
$the_query->the_post();
// START THE LOOP
echo '<div class="blog-feed">';
echo '<h2><a href="' . get_permalink() . '" class="blog-title">' . get_the_title() . '</a></h2>';
echo '<p>Posted on ' . get_the_time('F j, Y') . '</p>';
echo get_the_post_thumbnail();
echo the_content("Continue reading " . get_the_title());
echo '<p>Posted in ';
the_category(', ');
echo '</p>';
echo '<hr>';
echo '</div>';
}
echo '<div class="' . $pager_class . '">';
echo '<h4 class="forward-paging-link">' . get_next_posts_link('More Blog Posts »', $the_query->max_num_pages) . '</h4>';
echo '<h4 class="backward-paging-link">' . get_previous_posts_link('« Previous Blog Posts') . '</h4>';
echo '</div>';
wp_reset_postdata();
//reset
}
//END THE LOOP
}
示例5: totomo_posted_on
/**
* 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
}
示例6: the_breadcrumb
function the_breadcrumb()
{
if (!is_home()) {
echo '<a href="';
echo get_option('home');
echo '">';
echo "<img src=\"";
echo bloginfo('stylesheet_directory');
echo "/css/images/breadcrumbs_spinner.png\" style=\"display: block; float: left; margin: 0 10px 0 12px;\" />";
// bloginfo('name');
echo "</a> <img src=\"";
echo bloginfo('stylesheet_directory');
echo "/css/images/breadcrumbs_separrow.png\" style=\"display: block; float: left; margin: 0 0 0 -2px;\" /> ";
if (is_category() || is_single()) {
echo "<ul>";
the_category('title_li=');
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo "<ul><li>";
echo the_title();
echo "</li></ul>";
}
}
}
示例7: post_meta
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
}
示例8: MyBreadcrumb
function MyBreadcrumb()
{
if (!is_home()) {
echo '<li><a href="';
echo get_option('home');
echo '/">';
echo 'Home';
echo '</a><span class="divider">/</span></li>';
if (is_category() || is_single()) {
echo '<li>';
the_category(', ', '&title_li=');
echo '<span class="divider">/</span></li>';
echo '</li>';
if (is_single()) {
echo '<li class="active">';
// the_title();
echo '</li>';
}
} elseif (is_page()) {
echo '<li class="active">';
the_title();
echo '</li>';
}
}
}
示例9: the_breadcrumb
function the_breadcrumb()
{
echo '<div class="e-breadcrumbs">';
echo '<a href="';
echo get_option('home');
echo '">';
bloginfo('name');
echo "</a>";
if (is_category() || is_single()) {
echo " » ";
the_category(' • ');
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo " » ";
echo the_title();
} elseif (is_search()) {
echo " » Search Results for... ";
echo '"<em>';
echo the_search_query();
echo '</em>"';
}
echo '</div>';
}
示例10: smartadapt_the_bredcrumb
/**
* Print breadcrumb trail
*
*
*/
function smartadapt_the_bredcrumb()
{
//Get bredcrumb separator
$sep = smartadapt_option('breadcrumb_separator') ? smartadapt_option('breadcrumb_separator') : ' » ';
if (!is_front_page()) {
echo '<a href="';
echo home_url();
echo '">';
bloginfo('name');
echo '</a>' . $sep;
if (is_category() || is_single()) {
the_category($sep);
} elseif (is_archive() || is_single()) {
if (is_day()) {
printf(__('%s', 'smartadapt'), get_the_date());
} elseif (is_month()) {
printf(__('%s', 'smartadapt'), get_the_date(_x('F Y', 'monthly archives date format', 'smartadapt')));
} elseif (is_year()) {
printf(__('%s', 'smartadapt'), get_the_date(_x('Y', 'yearly archives date format', 'smartadapt')));
} else {
_e('Blog Archives', 'smartadapt');
}
}
if (is_page()) {
echo the_title();
}
}
}
示例11: b_wp_contents_show
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;
}
示例12: post_category
public function post_category($atts)
{
ob_start();
the_category(', ');
$category = ob_get_contents();
ob_end_clean();
return sprintf('<span class="tf_post_category">%s</span>', $category);
}
示例13: widget
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
}
示例14: xjsxj_posted_on
/**
* Prints HTML with meta information for the current post—date/time and author.
*
* @since xjsxj 1.0
*/
function xjsxj_posted_on()
{
printf(__('<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s ', 'xjsxj'), 'meta-prep meta-prep-author', sprintf('<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>', get_permalink(), esc_attr(get_the_date()), get_the_time('Y/m/d')), 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', 'xjsxj'), get_the_author()), get_the_author()));
// added by rocketxujia
echo __('评论[');
comments_popup_link('0', '1', '%');
echo __('] -');
the_category(', ');
}
示例15: agatha_breadcrumb
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>';
}