本文整理汇总了PHP中get_the_term_list函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_term_list函数的具体用法?PHP get_the_term_list怎么用?PHP get_the_term_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_the_term_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mtheme_portfolio_custom_columns
function mtheme_portfolio_custom_columns($column)
{
global $post;
$custom = get_post_custom();
$image_url = wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID));
$full_image_id = get_post_thumbnail_id($post->ID, 'thumbnail');
$full_image_url = wp_get_attachment_image_src($full_image_id, 'thumbnail');
$full_image_url = $full_image_url[0];
if (!defined('MTHEME')) {
$mtheme_shortname = "mtheme_p2";
define('MTHEME', $mtheme_shortname);
}
switch ($column) {
case "portfolio_image":
if (isset($image_url)) {
echo '<a class="thickbox" href="' . $full_image_url . '"><img src="' . $image_url . '" width="60px" height="60px" alt="featured" /></a>';
} else {
echo __('Image not found', 'mthemelocal');
}
break;
case "description":
if (isset($custom[MTHEME . '_thumbnail_desc'][0])) {
echo $custom[MTHEME . '_thumbnail_desc'][0];
}
break;
case "video":
if (isset($custom[MTHEME . '_lightbox_video'][0])) {
echo $custom[MTHEME . '_lightbox_video'][0];
}
break;
case "types":
echo get_the_term_list($post->ID, 'types', '', ', ', '');
break;
}
}
示例2: portfolio_columns_display
function portfolio_columns_display($portfolio_columns, $id)
{
global $post;
switch ($portfolio_columns) {
case "portfolio-image":
$image = wp_get_attachment_image(get_post_thumbnail_id($id), 'thumb');
if (!empty($image)) {
echo $image;
} else {
$data = get_post_meta($id, '_portfolio_settings', true);
$items = isset($data["items"]) ? $data["items"] : NULL;
if (!empty($items)) {
if (is_numeric($items[0])) {
wp_get_attachment_image($items[0]);
} else {
global $wp_embed;
echo $wp_embed->run_shortcode("[embed width='300']" . $items[0] . "[/embed]");
}
} else {
echo __("No Featured Image", 'dt_delicate');
}
}
break;
case "portfolio_entries":
echo get_the_term_list($post->ID, 'portfolio_entries', '', ', ', '');
break;
}
}
示例3: favethemes_videotags
function favethemes_videotags()
{
global $post;
global $wp_query;
$terms_as_text = strip_tags(get_the_term_list($wp_query->post->ID, 'video-tags', '', ', ', ''));
echo $terms_as_text;
}
示例4: __construct
public function __construct($data)
{
parent::__construct($data);
if ('' === $this->name) {
$this->name = 'taxonomy-list';
}
// If a taxonomy wasn't passed in, assume the first taxonomy associated with the post type.
if (!isset($data['taxonomy'])) {
$post_object_taxonomies = get_object_taxonomies($this->post_object);
$this->taxonomy = array_shift($post_object_taxonomies);
} else {
$this->taxonomy = $data['taxonomy'];
}
$this->before_list = isset($data['before-list']) ? $data['before-list'] : '';
$this->separator = isset($data['separator']) ? $data['separator'] : ', ';
$this->after_list = isset($data['after-list']) ? $data['after-list'] : '';
$this->include_links = isset($data['include-links']) ? $data['include-links'] : true;
$this->tag = isset($data['tag']) ? $data['tag'] : 'p';
if (true === $this->include_links) {
$this->content = get_the_term_list($this->post_object->ID, $this->taxonomy, $this->before_list, $this->separator, $this->after_list);
} else {
$terms_arr = get_the_terms($this->post_object->ID, $this->taxonomy);
$term_names_arr = array();
if (!empty($terms_arr)) {
foreach ($terms_arr as $term_obj) {
$term_names_arr[] = '<span class="name">' . $term_obj->name . '</span>';
}
$terms_list = implode($this->separator, $term_names_arr);
$this->content = $this->before_list . $terms_list . $this->after_list;
} else {
$this->content = '';
}
}
}
示例5: woo_tumblog_category_link
function woo_tumblog_category_link($post_id = 0, $type = 'articles')
{
$category_link = '';
if (get_option('woo_tumblog_content_method') == 'post_format') {
$post_format = get_post_format();
if ($post_format == '') {
$category = get_the_category();
$category_name = $category[0]->cat_name;
// Get the ID of a given category
$category_id = get_cat_ID($category_name);
// Get the URL of this category
$category_link = get_category_link($category_id);
} else {
$category_link = get_post_format_link($post_format);
}
} else {
$tumblog_list = get_the_term_list($post_id, 'tumblog', '', '|', '');
$tumblog_array = explode('|', $tumblog_list);
?>
<?php
$tumblog_items = array('articles' => get_option('woo_articles_term_id'), 'images' => get_option('woo_images_term_id'), 'audio' => get_option('woo_audio_term_id'), 'video' => get_option('woo_video_term_id'), 'quotes' => get_option('woo_quotes_term_id'), 'links' => get_option('woo_links_term_id'));
?>
<?php
// Get the ID of Tumblog Taxonomy
$category_id = $tumblog_items[$type];
$term =& get_term($category_id, 'tumblog');
// Get the URL of Articles Tumblog Taxonomy
$category_link = get_term_link($term, 'tumblog');
}
return $category_link;
}
示例6: apoc_byline
/**
* Generates a byline for posts and pages
* @version 2.0
*/
function apoc_byline()
{
// Get the current post within the loop
global $post;
$post_ID = $post->ID;
$author_ID = $post->post_author;
$type = $post->post_type;
$byline = '';
// Posts
if ($type == 'post') {
// Get some info
$author = '<a class="post-author" href="' . get_author_posts_url($author_ID) . '" title="All posts by ' . get_the_author_meta('display_name') . '">' . get_the_author_meta('display_name') . '</a>';
$published = '<time class="post-date" datetime="' . get_the_time('Y-m-d') . '">' . get_the_time('F j, Y') . '</time>';
$edit_link = current_user_can('edit_post', $post_ID) ? '<a class="post-edit-link" href="' . get_edit_post_link($post_ID) . '" title="Edit this post" target="_blank">Edit</a>' : "";
// Show a bunch of stuff for single views
if (is_single()) {
$avatar = new Apoc_Avatar(array('user_id' => $author_ID, 'type' => 'thumb', 'size' => 50));
$category = get_the_term_list($post_ID, 'category', ' in ', ', ', '');
$description = $avatar->avatar . '<span>By ' . $author . ' on ' . $published . $category . $edit_link . '</span>';
// Otherwise, a simple one-liner
} else {
$description = '<span>By ' . $author . ' on ' . $published . $edit_link . '</span>';
}
// Pages
} elseif ($type == 'page') {
$description = get_post_meta($post_ID, 'description', true);
if (current_user_can('edit_post', $post_ID)) {
$description = $description . '<a class="post-edit-link" href="' . get_edit_post_link($post_ID) . '" title="Edit this post" target="_blank">Edit</a>';
}
}
// Echo the post description
echo $description;
}
示例7: posttype_custom_columns
function posttype_custom_columns($column)
{
global $post;
switch ($column) {
case "thumbnail":
echo post_image_show() ? post_image_show(45, 45) : "<img src='" . THEME_DIR . "/resources/images/no-thumb.png'>";
break;
case "cause":
echo get_the_term_list($post->ID, 'cat_cause', '', ', ', '');
break;
case "portfolio":
echo get_the_term_list($post->ID, 'cat_portfolio', '', ', ', '');
break;
case "event":
echo get_the_term_list($post->ID, 'cat_event', '', ', ', '');
break;
case "price":
echo get_the_term_list($post->ID, 'cat_price', '', ', ', '');
break;
case "team":
echo get_the_term_list($post->ID, 'cat_team', '', ', ', '');
break;
case "testimonial":
echo get_the_term_list($post->ID, 'cat_testimonial', '', ', ', '');
break;
}
}
示例8: advertising_column
function advertising_column($column, $id)
{
$doc = get_post_meta($id, 'wp_custom_attachment_advertising', true);
$url = get_post_meta($id, 'advertising_url', true);
$term = get_the_term_list($id, 'tipo_advertising', " ");
switch ($column) {
case 'image':
?>
<a href="<?php
echo $doc['url'];
?>
" target="_blank"><?php
echo $doc['url'];
?>
</a>
<?php
break;
case 'advertising_url':
?>
<a href="<?php
echo $url;
?>
" target="_blank"><?php
echo $url;
?>
</a>
<?php
break;
case 'tipo':
echo $term;
break;
}
}
示例9: staff_column_display
function staff_column_display($column, $post_id)
{
// Code from: http://wpengineer.com/display-post-thumbnail-post-page-overview
switch ($column) {
// Display the staff position
case "staff_position":
if ($staff_position = get_post_meta(get_the_ID(), 'wpex_staff_position', true)) {
echo $staff_position;
} else {
echo __('None', 'wpex');
}
break;
// Display the staff tags in the column view
// Display the staff tags in the column view
case "staff_category":
if ($category_list = get_the_term_list($post_id, 'staff_category', '', ', ', '')) {
echo $category_list;
} else {
echo __('None', 'wpex');
}
break;
// Display the staff tags in the column view
// Display the staff tags in the column view
case "staff_tag":
if ($tag_list = get_the_term_list($post_id, 'staff_tag', '', ', ', '')) {
echo $tag_list;
} else {
echo __('None', 'wpex');
}
break;
}
}
示例10: portfolio_column_display
function portfolio_column_display($portfolio_columns, $post_id)
{
// Code from: http://wpengineer.com/display-post-thumbnail-post-page-overview
switch ($portfolio_columns) {
// Display the thumbnail in the column view
case "thumbnail":
$width = (int) 35;
$height = (int) 35;
$thumbnail_id = get_post_meta($post_id, '_thumbnail_id', true);
// Display the featured image in the column view if possible
if ($thumbnail_id) {
$thumb = wp_get_attachment_image($thumbnail_id, array($width, $height), true);
}
if (isset($thumb)) {
echo $thumb;
} else {
echo __('None', 'portfolioposttype');
}
break;
// Display the portfolio tags in the column view
// Display the portfolio tags in the column view
case "portfolio_filter":
if ($category_list = get_the_term_list($post_id, 'portfolio_filter', '', ', ', '')) {
echo $category_list;
} else {
echo __('None', 'portfolioposttype');
}
break;
}
}
示例11: populate_mbdb_book_columns
function populate_mbdb_book_columns($column, $post_id)
{
// get the book for the current row
$book = MBDB()->books->get($post_id);
// if the book is invalid, exit
if ($book == null) {
return;
}
// if this is the genre or series column (taxonomies)
// just get the term list and display that delimited by commas
// and then exit. No further processing necessary
if ($column == 'mbdb_genre' || $column == 'mbdb_series') {
do_action('mbdb_book_pre_' . $column . '_column');
echo apply_filters('mbdb_book_' . $column . '_column', get_the_term_list($post_id, $column, '', ', '));
do_action('mbdb_book_post_' . $column . '_column');
return;
}
// if the column is a property of book, grab that data
if (property_exists($book, $column)) {
$data = $book->{$column};
} else {
$data = '';
}
switch ($column) {
// book cover: display as an image
case 'cover':
do_action('mbdb_book_pre_mbdb_cover_column', $column, $data, $book);
if ($data != '') {
$alt = mbdb_get_alt_text($book->cover_id, __('Book Cover:', 'mooberry-book-manager') . ' ' . get_the_title($post_id));
echo apply_filters('mbdb_book_mbdb_cover_column', '<IMG SRC="' . esc_url($data) . '" width="100" ' . $alt . ' />', $column, $data, $book);
}
do_action('mbdb_book_post_mbdb_cover_column', $column, $data, $book);
break;
// release date: use short format
// release date: use short format
case 'release_date':
do_action('mbdb_book_pre_mbdb_published_column', $column, $data, $book);
if (!empty($data)) {
// TO DO validate data to be a date??
/* translators: short date format. see http://php.net/date */
echo apply_filters('mbdb_book_mbdb_published_column', date(__('m/d/Y'), strtotime($data)), $column, $data, $book);
}
do_action('mbdb_book_post_mbdb_published_column', $column, $data, $book);
break;
// publisher: display publisher name
// does not come from book object
// publisher: display publisher name
// does not come from book object
case 'publisher_id':
$publisher = mbdb_get_publisher_info($data);
do_action('mbdb_book_pre_mbdb_publisher_column', $column, $publisher, $book);
echo apply_filters('mbdb_book_mbdb_publisher_column', $publisher['name'], $column, $publisher, $book);
do_action('mbdb_book_post_mbdb_publisher_column', $column, $publisher, $book);
break;
default:
do_action('mbdb_book_pre_mbdb_' . $column . '_column', $column, $data, $book);
echo apply_filters('mbdb_book_mbdb_' . $column . '_column', $data, $book, $post_id, $column);
do_action('mbdb_book_post_mbdb_' . $column . '_column', $column, $data, $book);
}
}
示例12: edd_render_download_columns
/**
* Render Donwload Columns
*
* Render the custom columns content.
*
* @access private
* @since 1.0
* @return void
*/
function edd_render_download_columns($column_name, $post_id)
{
if (get_post_type($post_id) == 'download') {
$sales = edd_get_download_sales_stats($post_id);
$earnings = edd_get_download_earnings_stats($post_id);
$color = get_post_meta($post_id, '_edd_purchase_color', true);
$color = $color ? $color : 'blue';
$purchase_text = get_post_meta($post_id, '_edd_purchase_text', true);
$purchase_text = $purchase_text && '' !== $purchase_text ? $purchase_text : __('Purchase', 'edd');
switch ($column_name) {
case 'download_category':
echo get_the_term_list($post_id, 'download_category', '', ', ', '');
break;
case 'download_tag':
echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
break;
case 'price':
echo edd_price($post_id, false);
if (!edd_has_variable_prices($post_id)) {
echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
}
break;
case 'sales':
echo $sales;
break;
case 'earnings':
echo edd_currency_filter($earnings);
break;
case 'shortcode':
echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="button" color="' . esc_attr($color) . '"]';
break;
}
}
}
示例13: kbe_custom_columns
function kbe_custom_columns($column)
{
global $post;
switch ($column) {
case "title":
the_title();
break;
case "author":
the_author();
break;
case "cat":
echo get_the_term_list($post->ID, 'kbe_taxonomy', ' ', ', ', '');
break;
case "tag":
echo get_the_term_list($post->ID, 'kbe_tags', ' ', ', ', '');
break;
case "comment":
comments_number(__('No Comments', 'kbe'), __('1 Comment', 'kbe'), __('% Comments', 'kbe'));
break;
case "views":
$views = get_post_meta($post->ID, 'kbe_post_views_count', true);
if ($views) {
echo $views . __(' Views', 'kbe');
} else {
echo __('No Views', 'kbe');
}
break;
case "date":
the_date();
break;
}
}
示例14: get_be_themes_portfolio_category_list
function get_be_themes_portfolio_category_list($id, $link = false)
{
$terms = wp_get_object_terms($id, 'portfolio_categories');
$category = "";
$taxonomies = get_the_term_list($id, 'portfolio_categories', '', ' / ', '');
$taxonomies = strip_tags($taxonomies);
$term_count = count($terms);
$i = 0;
if ($link) {
foreach ($terms as $term) {
$term_link = get_term_link($term);
if (++$i === $term_count) {
$category .= '<a href="' . $term_link . '" class="cat-list">' . $term->name . '</a>';
} else {
$category .= '<a href="' . $term_link . '" class="cat-list">' . $term->name . '</a><span> · </span>';
}
}
} else {
foreach ($terms as $term) {
if (++$i === $term_count) {
$category .= $term->slug;
} else {
$category .= $term->slug . " | ";
}
}
}
return $category;
}
示例15: client_columns_display
function client_columns_display($client_columns, $post_id)
{
switch ($client_columns) {
// Code from: http://wpengineer.com/display-post-thumbnail-post-page-overview
case "client_thumbnail":
$thumbnail_id = get_post_meta($post_id, '_thumbnail_id', true);
if ($thumbnail_id) {
$thumb = wp_get_attachment_image($thumbnail_id, array(70, 70), true);
}
if (isset($thumb) && $thumb) {
echo $thumb;
} else {
echo __('None', 'EBD');
}
break;
case "client-cats":
global $post;
if ($cat_list = get_the_term_list($post->ID, 'client_cats', '', ', ', '')) {
echo $cat_list;
} else {
echo __('None', 'EBD');
}
break;
}
}