本文整理汇总了PHP中the_terms函数的典型用法代码示例。如果您正苦于以下问题:PHP the_terms函数的具体用法?PHP the_terms怎么用?PHP the_terms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_terms函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wcmpls_show_leads
/**
* Create a query to show all leads
*/
function wcmpls_show_leads()
{
$leads = new WP_Query(array('post_type' => 'employees', 'posts_per_page' => 100, 'tax_query' => array(array('taxonomy' => 'positions', 'field' => 'slug', 'terms' => array('developer-lead', 'design-lead', 'support-lead')))));
if ($leads->have_posts()) {
?>
<ul>
<?php
while ($leads->have_posts()) {
$leads->the_post();
?>
<li><?php
the_title();
?>
- <?php
the_terms(get_the_ID(), 'positions');
?>
</li>
<?php
}
wp_reset_postdata();
?>
</ul>
<?php
}
}
开发者ID:dannyb195,项目名称:Article-Ideas,代码行数:28,代码来源:employee-template-tags.php
示例2: custom_columns
/**
* Define our custom columns shown in admin.
* @param string $column
*/
public function custom_columns($column, $post_id)
{
switch ($column) {
case 'sp_league':
echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : __('All', 'prosports');
break;
case 'sp_season':
echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : __('All', 'prosports');
break;
case 'sp_team':
$teams = (array) get_post_meta($post_id, 'sp_team', false);
$teams = array_filter($teams);
if (empty($teams)) {
_e('All', 'prosports');
} else {
foreach ($teams as $team_id) {
if (!$team_id) {
continue;
}
$team = get_post($team_id);
if ($team) {
echo $team->post_title . '<br>';
}
}
}
break;
}
}
开发者ID:kleitz,项目名称:ProSports,代码行数:32,代码来源:class-sp-admin-cpt-directory.php
示例3: custom_columns
/**
* Define our custom columns shown in admin.
* @param string $column
*/
public function custom_columns($column, $post_id)
{
switch ($column) {
case 'sp_player':
$players = array_filter(get_post_meta($post_id, 'sp_player'));
echo sizeof($players);
break;
case 'sp_league':
echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : __('All', 'prosports');
break;
case 'sp_season':
echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : __('All', 'prosports');
break;
case 'sp_team':
$teams = (array) get_post_meta($post_id, 'sp_team', false);
$teams = array_filter($teams);
if (empty($teams)) {
echo __('All', 'prosports');
} else {
foreach ($teams as $team_id) {
if (!$team_id) {
continue;
}
$team = get_post($team_id);
if ($team) {
echo $team->post_title . '<br>';
}
}
}
break;
case 'sp_layout':
echo sp_array_value(SP()->formats->list, get_post_meta($post_id, 'sp_format', true), '—');
break;
}
}
开发者ID:kleitz,项目名称:ProSports,代码行数:39,代码来源:class-sp-admin-cpt-list.php
示例4: custom_columns
/**
* Define our custom columns shown in admin.
* @param string $column
*/
public function custom_columns($column, $post_id)
{
switch ($column) {
case 'sp_league':
echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : __('All', 'prosports');
break;
case 'sp_season':
echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : __('All', 'prosports');
break;
case 'sp_rounds':
echo get_post_meta($post_id, 'sp_rounds', true);
break;
}
}
开发者ID:kleitz,项目名称:ProSports,代码行数:18,代码来源:class-sp-admin-cpt-tournament.php
示例5: custom_columns
/**
* Define our custom columns shown in admin.
* @param string $column
*/
public function custom_columns($column, $post_id)
{
switch ($column) {
case 'sp_league':
echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : '—';
break;
case 'sp_season':
echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : '—';
break;
case 'sp_team':
$teams = array_filter(get_post_meta($post_id, 'sp_team'));
echo sizeof($teams);
break;
}
}
开发者ID:perren,项目名称:SportsPress,代码行数:19,代码来源:class-sp-admin-cpt-table.php
示例6: hocwp_the_terms
function hocwp_the_terms($args = array())
{
$terms = hocwp_get_value_by_key($args, 'terms');
$before = hocwp_get_value_by_key($args, 'before');
$sep = hocwp_get_value_by_key($args, 'separator', ', ');
$after = hocwp_get_value_by_key($args, 'after');
if (hocwp_array_has_value($terms)) {
echo $before;
$html = '';
foreach ($terms as $term) {
$html .= hocwp_get_term_link($term) . $sep;
}
$html = trim($html, $sep);
echo $html;
echo $after;
} else {
$post_id = hocwp_get_value_by_key($args, 'post_id', get_the_ID());
$taxonomy = hocwp_get_value_by_key($args, 'taxonomy');
$taxonomies = hocwp_get_value_by_key($args, 'taxonomies');
if (!is_array($taxonomies)) {
$taxonomies = array();
}
if (!empty($taxonomy) && !in_array($taxonomy, $taxonomies)) {
$taxonomies[] = $taxonomy;
}
$has_term = false;
foreach ($taxonomies as $taxonomy) {
if (has_term('', $taxonomy, $post_id)) {
$has_term = true;
break;
}
}
if (!$has_term) {
return;
}
echo $before;
ob_start();
foreach ($taxonomies as $taxonomy) {
the_terms($post_id, $taxonomy, '', $sep, '');
echo $sep;
}
$html = ob_get_clean();
$html = trim($html, $sep);
echo $html;
echo $after;
}
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:47,代码来源:term.php
示例7: custom_columns
/**
* Define our custom columns shown in admin.
* @param string $column
*/
public function custom_columns($column, $post_id)
{
switch ($column) {
case 'sp_league':
echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : __('All', 'sportspress');
break;
case 'sp_season':
echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : __('All', 'sportspress');
break;
case 'sp_rounds':
echo get_post_meta($post_id, 'sp_rounds', true);
break;
case 'sp_layout':
echo sp_array_value(SP()->formats->tournament, get_post_meta($post_id, 'sp_format', true), '—');
break;
}
}
开发者ID:mttcmrn,项目名称:Suffield-Bruins-WP,代码行数:21,代码来源:class-sp-admin-cpt-tournament.php
示例8: list_categories_from_current_custom_post
function list_categories_from_current_custom_post($customTax)
{
global $post;
$customCats = get_the_terms('', $customTax);
if ($customCats) {
?>
<h5>Categories</h5>
<?php
the_terms($post->ID, "service_type", '', ', ', ' ');
?>
<?php
//echo '<ul>';
//echo get_the_term_list( $post->ID, $customTax, '<li>', ',</li><li>', '</li>' );
//echo '</ul>';
}
}
开发者ID:pixelstorm,项目名称:nav_systems,代码行数:19,代码来源:get_cpt_terms_from_current_post.php
示例9: custom_columns
/**
* Define our custom columns shown in admin.
* @param string $column
*/
public function custom_columns($column, $post_id)
{
switch ($column) {
case 'sp_league':
echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : __('All', 'prosports');
break;
case 'sp_season':
echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : __('All', 'prosports');
break;
case 'sp_venue':
echo get_the_terms($post_id, 'sp_venue') ? the_terms($post_id, 'sp_venue') : __('All', 'prosports');
break;
case 'sp_team':
$teams = (array) get_post_meta($post_id, 'sp_team', false);
$teams = array_filter($teams);
if (empty($teams)) {
echo __('All', 'prosports');
} else {
$current_team = get_post_meta($post_id, 'sp_current_team', true);
foreach ($teams as $team_id) {
if (!$team_id) {
continue;
}
$team = get_post($team_id);
if ($team) {
echo $team->post_title;
if ($team_id == $current_team) {
echo '<span class="dashicons dashicons-yes" title="' . __('Current Team', 'prosports') . '"></span>';
}
echo '<br>';
}
}
}
break;
case 'sp_events':
$calendar = new SP_Calendar($post_id);
echo sizeof($calendar->data());
break;
case 'sp_layout':
echo sp_array_value(SP()->formats->calendar, get_post_meta($post_id, 'sp_format', true), '—');
break;
}
}
开发者ID:kleitz,项目名称:ProSports,代码行数:47,代码来源:class-sp-admin-cpt-calendar.php
示例10: custom_columns
/**
* Define our custom columns shown in admin.
* @param string $column
*/
public function custom_columns($column, $post_id)
{
switch ($column) {
case 'sp_league':
echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : '—';
break;
case 'sp_season':
echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : '—';
break;
case 'sp_team':
$select = get_post_meta($post_id, 'sp_select', true);
if ('manual' == $select) {
$teams = array_filter(get_post_meta($post_id, 'sp_team'));
echo sizeof($teams);
} else {
_e('Auto', 'sportspress');
}
break;
}
}
开发者ID:engrmostafijur,项目名称:SportsPress,代码行数:24,代码来源:class-sp-admin-cpt-table.php
示例11: manage_columns
public function manage_columns($column_name, $id)
{
global $wpdb;
switch ($column_name) {
case 'client-type':
$transport_type = get_post_meta($id, 'syn_transport_type', true);
try {
$client = Syndication_Client_Factory::get_client($transport_type, $id);
$client_data = $client->get_client_data();
echo esc_html(sprintf('%s (%s)', $client_data['name'], array_shift($client_data['modes'])));
} catch (Exception $e) {
printf(__('Unknown (%s)', 'push-syndication'), esc_html($transport_type));
}
break;
case 'syn_sitegroup':
the_terms($id, 'syn_sitegroup', '', ', ', '');
break;
default:
break;
}
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:21,代码来源:class-wp-push-syndication-server.php
示例12: custom_columns
/**
* Define our custom columns shown in admin.
* @param string $column
*/
public function custom_columns($column, $post_id)
{
switch ($column) {
case 'sp_icon':
echo has_post_thumbnail($post_id) ? edit_post_link(get_the_post_thumbnail($post_id, 'prosports-fit-mini'), '', '', $post_id) : '';
break;
case 'sp_url':
echo sp_get_url($post_id);
break;
case 'sp_abbreviation':
$abbreviation = get_post_meta($post_id, 'sp_abbreviation', true);
echo $abbreviation ? $abbreviation : '—';
break;
case 'sp_league':
echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : '—';
break;
case 'sp_season':
echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : '—';
break;
}
}
开发者ID:kleitz,项目名称:ProSports,代码行数:25,代码来源:class-sp-admin-cpt-team.php
示例13: manage_columns
public function manage_columns($column_name, $id)
{
global $client_manager;
switch ($column_name) {
// Output the client label
case 'client-type':
// Fetch the site transport type
$transport_type = get_post_meta($id, 'syn_transport_type', true);
// Fetch the corresponding client
$pull_client = $client_manager->get_pull_or_push_client($transport_type);
// Output the client name
if (isset($pull_client['label'])) {
echo esc_html($pull_client['label']);
}
break;
case 'syn_sitegroup':
the_terms($id, 'syn_sitegroup', '', ', ', '');
break;
default:
break;
}
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:22,代码来源:class-site-list-screen.php
示例14: aaron_portfolio_footer
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function aaron_portfolio_footer()
{
if (get_theme_mod('aaron_hide_meta') == "") {
echo '<footer class="entry-footer">';
global $post;
echo '<a href="' . esc_url(home_url('/portfolio/')) . '"><b>' . __('Portfolio', 'aaron') . '</b></a><br/><br/>';
//the_terms( $id, $taxonomy, $before, $sep, $after );
echo the_terms($post->ID, 'jetpack-portfolio-type', '<span class="jetpack-portfolio-type"><i aria-hidden="true"></i>' . __('Project Type: ', 'aaron'), ', ', '</span>');
echo the_terms($post->ID, 'jetpack-portfolio-tag', '<span class="tags-links"><i aria-hidden="true"></i>' . __('Project Tags: ', 'aaron'), ', ', '</span>');
/* translators: % is the post title */
edit_post_link(sprintf(__('Edit %s', 'aaron'), get_the_title()), '<span class="edit-link"><i aria-hidden="true"></i>', '</span>');
/* Display jetpack's share if it's active*/
if (function_exists('sharing_display')) {
echo sharing_display();
}
/* Display jetpack's like if it's active */
if (class_exists('Jetpack_Likes')) {
$aaron_custom_likes = new Jetpack_Likes();
echo $aaron_custom_likes->post_likes('');
}
echo '</footer><!-- .entry-footer -->';
}
}
开发者ID:michellekusold,项目名称:taasc,代码行数:26,代码来源:template-tags.php
示例15: pr_info_bar_render
function pr_info_bar_render()
{
global $smof_data, $post;
$show_info = 1;
if (is_single()) {
$show_info = $smof_data['show_info_post'] ? $show_info : 0;
} else {
$show_info = $smof_data['show_info_blog'] ? $show_info : 0;
}
ob_start();
?>
<?php
if ($show_info) {
?>
<div class="blog-info">
<time class="publish-date" datetime="<?php
echo get_the_date('Y-m-j') . ' ' . get_the_time('H:i:s');
?>
" pubdate="pubdate">
<?php
_e('Published on', THEMENAME);
?>
<?php
echo get_the_date('l, j F Y') . ' ' . get_the_time('H:i');
?>
</time>
<span class="category-name"><?php
the_terms(get_the_ID(), 'category', __('Category: ', THEMENAME), ', ');
?>
</span>
</div>
<?php
}
?>
<?php
return ob_get_clean();
}
开发者ID:jesusone,项目名称:wp_astro,代码行数:37,代码来源:templetes.function.php
示例16: get_the_category
?>
"><?php
echo $title;
?>
</a><?php
echo $role;
?>
</span><br>
<span class="categories">
Categories:
<?php
$categories = get_the_category();
$i = 0;
$cats = array('mb_knowledge_cat', 'mb_in-the-news_cat');
if ($categories[0] == "") {
the_terms(get_the_ID(), $cats);
} else {
foreach ($categories as $category) {
if ($i > 0) {
echo ', ';
}
$i++;
echo '<a href="' . get_category_link($category->term_id) . '">' . $category->name . '</a>';
}
}
?>
</span>
</div>
<div class="content">
<?php
开发者ID:sefrijn,项目名称:metabolic,代码行数:31,代码来源:single-content.php
示例17: get_template_part
<?php
get_template_part('tpls/header', 'menu');
?>
<div class="container">
<!-- project header -->
<div class="project_header">
<div class="ten columns alpha project_title">
<h1><?php
the_title();
?>
</h1>
<h2><?php
the_terms(get_the_ID(), 'portfolio-category');
?>
</h2>
</div>
<div class="six columns prev_next">
<a href="<?php
echo $prev_post_link;
?>
" class="next"><span><?php
_e('上一个项目', TD);
?>
</span></a>
<a href="<?php
echo $next_post_link;
开发者ID:w392807287,项目名称:FirstRepository,代码行数:31,代码来源:single-portfolio.php
示例18: the_author
</h3>
<ul class="blog_meta cf">
<li class="by"><span class="meta_icon" aria-hidden="true" data-icon="#"></span><?php
the_author();
?>
</li>
<li class="on"><span class="meta_icon" aria-hidden="true" data-icon="%"></span><?php
the_time('j M Y');
?>
</li>
<li class="in"><span class="meta_icon" aria-hidden="true" data-icon=","></span><?php
the_terms($post->ID, 'community-categories', '', '', '');
?>
</li>
<li class="tags"><span class="meta_icon" aria-hidden="true" data-icon="."></span><?php
the_terms($post->ID, 'community-key-words', '', ', ', '');
?>
</li>
</ul>
</hgroup>
<div class="art_txt">
<?php
the_content();
?>
</div>
<?php
include_once "likes.php";
?>
开发者ID:raphaelcohn,项目名称:health-and-care-developer-network,代码行数:31,代码来源:community-blog.php
示例19: the_permalink
</div><!-- /postMeta -->
<div class="postContent">
<h2 class="postTitle"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<div class="post-date"><span class="fa-calendar"></span> <?php
the_time('F j, Y');
?>
</div>
<div class="post-cats"><?php
the_terms($post->ID, 'news_category', '', ', ');
?>
</div>
<!-- postExcerpt -->
<!-- Defaults to 55 chars, strips out all HTML except <a>, <p>, and <strong>. Can be modified in oms-theme-functions.php. -->
<div class="storyContent posts postExcerpt">
<?php
the_excerpt();
?>
</div><!-- /postExcerpt -->
</div>
</div><!-- /postExcerptsContainer -->
开发者ID:pjsinco,项目名称:doctorsthatdo,代码行数:30,代码来源:page-newsLanding.php
示例20: the_terms
?>
</a></h3>
<?php
if (get_the_terms($post->ID, 'portfolio-tags') != false) {
?>
<div class="tztag">
TAG: <?php
the_terms($post->ID, 'portfolio-tags', '', ',');
?>
</div>
<?php
}
?>
<div class="tzcat">
CATEGORY : <?php
the_terms($post->ID, 'portfolio-category', '', ',');
?>
</div>
<div class="description">
<?php
the_excerpt();
?>
</div>
</div>
</div>
<?php
}
// end while have posts
}
// end if have posts
wp_reset_postdata();
开发者ID:vanduy99,项目名称:plazarttheme,代码行数:31,代码来源:template-portfolio.php
注:本文中的the_terms函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论