当前位置: 首页>>代码示例>>PHP>>正文


PHP get_the_taxonomies函数代码示例

本文整理汇总了PHP中get_the_taxonomies函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_taxonomies函数的具体用法?PHP get_the_taxonomies怎么用?PHP get_the_taxonomies使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_the_taxonomies函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_get_the_taxonomies_term_template

 /**
  * @group 27238
  */
 public function test_get_the_taxonomies_term_template()
 {
     $post_id = $this->factory->post->create();
     $taxes = get_the_taxonomies($post_id, array('term_template' => '%2$s'));
     $this->assertEquals('Categories: Uncategorized.', $taxes['category']);
     $taxes = get_the_taxonomies($post_id, array('term_template' => '<span class="foo"><a href="%1$s">%2$s</a></span>'));
     $link = get_category_link(1);
     $this->assertEquals('Categories: <span class="foo"><a href="' . $link . '">Uncategorized</a></span>.', $taxes['category']);
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:12,代码来源:taxonomy.php

示例2: cftl_tax_landing_messages

function cftl_tax_landing_messages($messages)
{
    global $post;
    $taxonomy_array = get_the_taxonomies($post);
    if (!empty($taxonomy_array)) {
        $taxonomy_links = implode(' ', $taxonomy_array);
    } else {
        $taxonomy_links = __("No taxonomies specified.", 'cf-tax-landing');
    }
    $messages['cftl-tax-landing'] = array(0 => '', 1 => sprintf(__('Landing Page updated.  %s', 'cf-tax-landing'), $taxonomy_links), 2 => __('Custom field updated.'), 3 => __('Custom field deleted.'), 4 => __('Landing Page updated.', 'cf-tax-landing'), 5 => isset($_GET['revision']) ? sprintf(__('Landing Page restored to revision from %s', 'cf-tax-landing'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('Landing Page published.  %s', 'cf-tax-landing'), $taxonomy_links), 7 => __('Landing Page saved.', 'cf-tax-landing'), 8 => sprintf(__('Landing Page submitted.  %s', 'cf-tax-landing'), $taxonomy_links), 9 => sprintf(__('Landing Page scheduled for: <strong>%1$s</strong>.', 'cf-tax-landing'), date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date))), 10 => sprintf(__('Landing Page updated.', 'cf-tax-landing')));
    return $messages;
}
开发者ID:netconstructor,项目名称:wp-taxonomy-landing,代码行数:12,代码来源:cftl-post-type.php

示例3: test_get_the_taxonomies

 function test_get_the_taxonomies()
 {
     $post_id = $this->factory->post->create();
     $taxes = get_the_taxonomies($post_id);
     $this->assertNotEmpty($taxes);
     $this->assertEquals(array('category'), array_keys($taxes));
     $id = $this->factory->tag->create();
     wp_set_post_tags($post_id, array($id));
     $taxes = get_the_taxonomies($post_id);
     $this->assertNotEmpty($taxes);
     $this->assertCount(2, $taxes);
     $this->assertEquals(array('category', 'post_tag'), array_keys($taxes));
 }
开发者ID:boonebgorges,项目名称:wp,代码行数:13,代码来源:taxonomy.php

示例4: get_single

 /**
  * Get a single already created AM_Tax.
  *
  * @since 1.2.0
  *
  * @param  null|string $tax_slug Slug of the AM_Tax to get. If null, the first current taxonomy is used.
  * @return null|AM_Tax           The requested AM_Tax, if it exists.
  */
 public static function get_single($tax_slug = null)
 {
     $tax_slug = isset($tax_slug) ? (array) $tax_slug : array_keys(get_the_taxonomies());
     // Get the first entry.
     $tax_slug = reset($tax_slug);
     return array_key_exists($tax_slug, self::$_all_taxs) ? self::$_all_taxs[$tax_slug] : null;
 }
开发者ID:noplanman,项目名称:am-cpts,代码行数:15,代码来源:class-am-cpt-tax.php

示例5: templatic_manage_seller_columns

function templatic_manage_seller_columns($column, $post_id)
{
    echo '<link href="' . get_template_directory_uri() . '/monetize/admin.css" rel="stylesheet" type="text/css" />';
    global $post;
    switch ($column) {
        /* If displaying the 'status' column. */
        case 'status':
            /* Get the post meta. */
            $status = fetch_status(get_post_meta($post_id, 'status', true), get_post_meta($post_id, 'is_expired', true));
            /* If no status is found, output a default message. */
            _e($status, 'templatic');
            break;
            /* If displaying the 'coupon_start_date_time' column. */
        /* If displaying the 'coupon_start_date_time' column. */
        case 'coupon_start_date_time':
            /* Get the coupon_start_date_time for the post. */
            $coupon_start_date_time = get_post_meta($post_id, 'coupon_start_date_time', true);
            /* If coupon_start_date_time were found. */
            if ($coupon_start_date_time != '') {
                echo date('Y-m-d H:i:s', $coupon_start_date_time);
            } else {
                _e('Unknown');
            }
            break;
        case 'coupon_end_date_time':
            /* Get the coupon_end_date_time for the post. */
            $coupon_end_date_time = get_post_meta($post_id, 'coupon_end_date_time', true);
            /* If coupon_end_date_time were found. */
            if (!empty($coupon_end_date_time)) {
                echo date('Y-m-d H:i:s', $coupon_end_date_time);
            } else {
                _e('Continue deal');
            }
            break;
        case 'deal_sold':
            /* Get the deal_sold for the post. */
            $deal_sold = deal_transaction($post_id);
            /* If deal_sold were found. */
            if (!empty($deal_sold)) {
                echo $deal_sold;
            } else {
                _e('0');
            }
            break;
        case 'post_category':
            /* Get the post_category for the post. */
            if (templ_is_show_post_category()) {
                $category = get_the_taxonomies($post);
                $category_display = str_replace(CUSTOM_MENU_CAT_TITLE . ':', '', $category['seller_category']);
                $category_display = str_replace(' and ', ', ', $category_display);
                echo $category_display = str_replace(',,', ', ', $category_display);
            } else {
                _e('Uncategorized');
            }
            break;
        case 'post_tags':
            /* Get the post_tags for the post. */
            $tags = get_the_taxonomies($post);
            $tags_display = str_replace(CUSTOM_MENU_TAG_TITLE . ':', '', $tags['seller_tags']);
            $tags_display = str_replace(' and ', ', ', $tags_display);
            echo $tags_display = str_replace(',,', ', ', $tags_display);
            break;
        case 'total_item':
            /* Get the total_item for the post. */
            $total_item = get_post_meta($post_id, 'no_of_coupon', true);
            /* If terms were found. */
            if (!empty($total_item)) {
                echo $total_item;
            } else {
                _e('0');
            }
            break;
            /* Just break out of the switch statement for everything else. */
        /* Just break out of the switch statement for everything else. */
        default:
            break;
    }
}
开发者ID:annguyenit,项目名称:getdeal,代码行数:78,代码来源:custom_post_type.php

示例6: widget


//.........这里部分代码省略.........
		        					<?php 
                    }
                    ?>
		        					</div>
		        					<?php 
                    if ($instance["mmeta"] == 'aimage') {
                        echo $this->blog_multimeta($instance);
                    }
                    ?>
		        				</div>
		        		   <?php 
                }
                ?>
			        		  <?php 
                if ($video && $instance["mvideo"] == 'atitle') {
                    ?>
		        						<?php 
                    echo do_shortcode($sc);
                    ?>
		        				 <?php 
                }
                ?>
			        		  <?php 
                if ($instance["mmeta"] == 'atitle') {
                    echo $this->blog_multimeta($instance);
                }
                ?>
			        		  <?php 
                if ($instance["excerpt"] == 'true') {
                    ?>
				        		 <p class="post-excerpt"><?php 
                    echo wp_html_excerpt(get_the_excerpt(), $instance["excerptlength"]);
                    ?>
...</p>
			        		  <?php 
                } elseif ($instance['excerpt'] == 'content') {
                    ?>
			        		  	<p class="post-excerpt"><?php 
                    the_content();
                    ?>
</p>
			        		  <?php 
                }
                ?>
			        		  <?php 
                if ($instance["mmeta"] == 'atext') {
                    echo $this->blog_multimeta($instance);
                }
                $tax = '';
                if ($instance["mcats"] == 'acontent') {
                    $tax = array();
                    $_tax = array();
                    $_tax = get_the_taxonomies();
                    if (empty($_tax)) {
                    } else {
                        foreach ($_tax as $key => $value) {
                            preg_match('/(.+?): /i', $value, $matches);
                            $tax[] = '<span class="entry-tax-' . $key . '">' . str_replace($matches[0], '<span class="entry-tax-meta">' . $matches[1] . ':</span> ', $value) . '</span>';
                        }
                    }
                    echo '<div class="post-meta taxonomy">' . join('<br />', $tax) . '</div>';
                }
                if ($instance["mreadmore"] != 'false') {
                    ?>
			        		  		<p style="text-align:<?php 
                    echo $instance["mreadmore"];
                    ?>
">
			        		  		<a href="<?php 
                    the_permalink();
                    ?>
" class="readmorecontent" >
			        		  			<?php 
                    _e($instance["rmtext"], THEME_LANG_DOMAIN);
                    ?>
			        		  		</a>
			        		  		</p>
			        		  <?php 
                }
                ?>
			        		  </div>
			        		  </div>
			        		</div>
		        		 
		        		  
		        		  <?php 
                if ($i == 1) {
                    echo '<div style="clear:both"></div>';
                }
            }
        }
        ?>
        <?php 
        echo '<div style="clear:both"></div>';
        ?>

        <?php 
        wp_reset_postdata();
        $wp_filter['the_content'] = $the_content_filter_backup;
    }
开发者ID:shieldsdesignstudio,项目名称:forefield,代码行数:101,代码来源:custom-content.php

示例7: shortcode_podcast_show

 public function shortcode_podcast_show($attr)
 {
     $err = -1;
     $show = "";
     $all_shows = get_terms('podcast_show', 'hide_empty=0');
     $speaker_tax = 'podcast_speaker';
     $series_tax = 'podcast_series';
     // Error #2: No showname in shortcode given!
     if (empty($attr)) {
         $err = 2;
     }
     // if attributes are given check if these are
     // podcast_show slugs and list only these shows
     if (!empty($attr) and isset($attr['show'])) {
         $possible_shows = $this->get_all_shows($all_shows);
         // Asume: Error #3: No show exists with that name!
         $err = 3;
         foreach ($attr as $key => $value) {
             if (in_array($value, $possible_shows)) {
                 $show = $value;
                 $err = -1;
             }
         }
     }
     $args = array('post_type' => self::POST_TYPE, 'order' => 'DESC', 'oderby' => 'date', 'tax_query' => array('relation' => 'AND', array('taxonomy' => 'podcast_show', 'field' => 'slug', 'terms' => $show)));
     $category_posts = new WP_Query($args);
     $episodes = array();
     while ($category_posts->have_posts()) {
         $category_posts->the_post();
         $i = array_push($episodes, $category_posts->post);
         $postID = $episodes[$i - 1]->ID;
         // $post_tax = array();
         // $post_tax['podcast_show'] = wp_get_post_terms( $postID, 'podcast_show' );
         // $post_tax['podcast_speaker'] = wp_get_post_terms( $postID, $speaker_tax );
         // $post_tax['podcast_series'] = wp_get_post_terms( $postID, $series_tax );
         // $episodes[$i-1]->taxonomies = $post_tax;
         $episodes[$i - 1]->taxonomies = get_the_taxonomies($postID);
         $episodes[$i - 1]->metadata = get_metadata('post', $postID);
     }
     include dirname(dirname(__FILE__)) . 'shortcodes/templates/shortcode_podcast_show-template.php';
 }
开发者ID:ICFMovement,项目名称:dicentis,代码行数:41,代码来源:class-dipo-podcast-post-type.php

示例8: the_taxonomies

function the_taxonomies($args = array()) {
	$defaults = array(
		'post' => 0,
		'before' => '',
		'sep' => ' ',
		'after' => '',
	);

	$r = wp_parse_args( $args, $defaults );
	extract( $r, EXTR_SKIP );

	echo $before . join($sep, get_the_taxonomies($post)) . $after;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:13,代码来源:taxonomy.php

示例9: yoast_breadcrumb

function yoast_breadcrumb($prefix = '', $suffix = '', $display = true)
{
    global $wp_query, $post, $curauth;
    $opt = get_option("yoast_breadcrumbs");
    function bold_or_not($input)
    {
        $opt = get_option("yoast_breadcrumbs");
        if ($opt['boldlast']) {
            return '' . $input . '';
        } else {
            return $input;
        }
    }
    // Copied and adapted from WP source
    function yoast_get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE)
    {
        $chain = '';
        $parent =& get_category($id);
        if (is_wp_error($parent)) {
            return $parent;
        }
        if ($nicename) {
            $name = $parent->slug;
        } else {
            $name = $parent->cat_name;
        }
        if ($parent->parent && $parent->parent != $parent->term_id) {
            $chain .= get_category_parents($parent->parent, true, $separator, $nicename);
        }
        $chain .= bold_or_not($name);
        return $chain;
    }
    function yoast_get_term_parents($id, $term_type = 'category', $link = FALSE, $separator = '/', $nicename = FALSE)
    {
        $chain = '';
        $category = get_term($id, $term_type, $output, $filter);
        if (is_wp_error($category)) {
            return $category;
        }
        _make_cat_compat($category);
        $parent = $category;
        if (is_wp_error($parent)) {
            return $parent;
        }
        if ($nicename) {
            $name = $parent->slug;
        } else {
            $name = $parent->cat_name;
        }
        $term_child = get_term_children($id, $term_type);
        if ($parent->parent && $parent->parent != $parent->term_id) {
            $chain .= '<a href="' . get_term_link($parent->parent, $term_type) . '">' . yoast_get_term_parents($parent->parent, $term_type, true, $separator, $nicename) . '</a>' . $separator;
        }
        $chain .= bold_or_not($name);
        return $chain;
    }
    $nofollow = ' ';
    if ($opt['nofollowhome']) {
        $nofollow = ' rel="nofollow" ';
    }
    $on_front = get_option('show_on_front');
    if ($on_front == "page") {
        $homelink = '<a' . $nofollow . 'href="' . get_permalink(get_option('page_on_front')) . '">' . $opt['home'] . '</a>';
        $bloglink = $homelink . ' ' . $opt['sep'] . ' <a href="' . get_permalink(get_option('page_for_posts')) . '">' . $opt['blog'] . '</a>';
    } else {
        $homelink = '<a' . $nofollow . 'href="' . get_bloginfo('url') . '">' . $opt['home'] . '</a>';
        $bloglink = $homelink;
    }
    if ($on_front == "page" && is_front_page() || $on_front == "posts" && is_home()) {
        $output = bold_or_not($opt['home']);
    } elseif ($on_front == "page" && is_home()) {
        $output = $homelink . ' ' . $opt['sep'] . ' ' . bold_or_not($opt['blog']);
    } elseif (!is_page()) {
        $output = $bloglink . ' ' . $opt['sep'] . ' ';
        if ((is_single() || is_category() || is_tag() || is_date() || is_author()) && $opt['singleparent'] != 0) {
            $output .= '<a href="' . get_permalink($opt['singleparent']) . '">' . get_the_title($opt['singleparent']) . '</a> ' . $opt['sep'] . ' ';
        }
        if (is_single() && $opt['singlecatprefix']) {
            if ($post->post_type == CUSTOM_POST_TYPE1) {
                global $post;
                $cats = wp_get_post_terms($post->ID, CUSTOM_CATEGORY_TYPE1);
                $cat = $cats[0];
                //$output .= yoast_get_term_parents($cat->term_id,CUSTOM_CATEGORY_TYPE1, true, " ".$opt['sep']." ");
                $output .= join(" " . $opt['sep'] . " ", get_the_taxonomies($post)) . " " . $opt['sep'] . " ";
            } else {
                $cats = get_the_category();
                $cat = $cats[0];
                if ($cat) {
                    $output .= get_category_parents($cat->term_id, true, " " . $opt['sep'] . " ");
                }
            }
        }
        if (is_archive()) {
            if (is_tag()) {
                $output .= bold_or_not($opt['archiveprefix'] . " " . single_cat_title('', false));
            } elseif (is_date()) {
                $output .= bold_or_not($opt['archiveprefix'] . " " . single_month_title(' ', false));
            } elseif (is_author()) {
                $user = get_userdatabylogin($wp_query->query_vars['author_name']);
                $output .= bold_or_not($opt['archiveprefix'] . " " . $curauth->nickname);
//.........这里部分代码省略.........
开发者ID:exploit86,项目名称:Devoncha,代码行数:101,代码来源:yoast-breadcrumbs.php

示例10: get_field

        ?>
					<div class="slide-3">
						<?php 
        if (get_field('link_externo') == "") {
            $link = get_field('link2');
        } else {
            $link = get_field('link_externo');
        }
        ?>
						<div class="texto-slider">
						<a href="<?php 
        echo $link;
        ?>
">
						<?php 
        $titulo = get_the_taxonomies($post->ID);
        the_content();
        ?>
						</a>			
						</div>
						<a href="<?php 
        echo $link;
        ?>
">
						<?php 
        the_post_thumbnail('slider-1');
        ?>
		
						</a>			
					</div>
					<?php 
开发者ID:willowmagrini,项目名称:dg,代码行数:31,代码来源:front-page.php

示例11: the_content

            the_content();
            ?>
	</div><!-- [ /.entry-body ] -->

	<div class="entry-footer">
	<?php 
            $args = array('before' => '<nav class="page-link"><dl><dt>Pages :</dt><dd>', 'after' => '</dd></dl></nav>', 'link_before' => '<span class="page-numbers">', 'link_after' => '</span>', 'echo' => 1);
            wp_link_pages($args);
            ?>

	<?php 
            /*-------------------------------------------*/
            /*  Category and tax data
            	/*-------------------------------------------*/
            $args = array('template' => __('<dl><dt>%s</dt><dd>%l</dd></dl>', 'lightning'), 'term_template' => '<a href="%1$s">%2$s</a>');
            $taxonomies = get_the_taxonomies($post->ID, $args);
            $taxnomiesHtml = '';
            if ($taxonomies) {
                foreach ($taxonomies as $key => $value) {
                    if ($key != 'post_tag') {
                        $taxnomiesHtml .= '<div class="entry-meta-dataList">' . $value . '</div>';
                    }
                }
                // foreach
            }
            // if ($taxonomies)
            $taxnomiesHtml = apply_filters('lightning_taxnomiesHtml', $taxnomiesHtml);
            echo $taxnomiesHtml;
            ?>

	<?php 
开发者ID:Dr0na,项目名称:Lightning,代码行数:31,代码来源:single.php

示例12: ultimatum_post_tax

function ultimatum_post_tax() {
	global $post;
	$_tax = get_the_taxonomies();
	if (!empty($_tax) ){
		foreach ( $_tax as $key => $value ) {
			preg_match( '/(.+?): /i', $value, $matches );
			$tax[] = '<span class="entry-tax-'. $key .'">' . str_replace( $matches[0], '<span class="entry-tax-meta">'. $matches[1] .':</span> ', $value ) . '</span>';
		}
	}
	if(count($tax)!=0){
	echo '<div class="post-taxonomy">'.join( '<br />', $tax ).'</div>';
	}
}
开发者ID:polaris610,项目名称:medicalhound,代码行数:13,代码来源:loop-functions.php

示例13: the_title

        the_title('<h1 class="entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h1>');
    }
    ?>

						<div class="entry-meta">
							<?php 
    if (!post_password_required() && (comments_open() || get_comments_number())) {
        ?>
							<span class="comments-link"><?php 
        comments_popup_link(__('Leave a comment', 'dicentis'), __('1 Comment', 'dicentis'), __('% Comments', 'dicentis'));
        ?>
</span>
							<?php 
    }
    edit_post_link(__('Edit', 'dicentis'), '<span class="edit-link">', '</span>');
    $taxonomy_names = get_the_taxonomies();
    foreach ($taxonomy_names as $key => $value) {
        echo $value;
        echo " | ";
    }
    ?>
						</div><!-- .entry-meta -->
					</header><!-- .entry-header -->

					<?php 
    if (is_search()) {
        ?>

					<?php 
    } else {
        ?>
开发者ID:ICFMovement,项目名称:dicentis,代码行数:31,代码来源:episode-single-template.php

示例14: esc_html__



	<!--Portfolio holder -->
	<div class="relatedHolder ofsTop ofsBottom">

		<!--Title-->
		<div class="title dark ">
			<h1>
				<?php 
        echo esc_html__('Related Works', 'pranon');
        ?>
<span class="plus">+</span>
			</h1>
		</div>
		<?php 
        $taxonomy = get_the_taxonomies(get_the_ID());
        if (isset($taxonomy)) {
            foreach ($taxonomy as $key => $name) {
                $taxonomy_name = $key;
            }
            $get_terms = get_the_terms(get_the_ID(), $taxonomy_name);
            $term = array();
            $display_term = '';
            foreach ($get_terms as $key => $get_term) {
                array_push($term, $get_term->slug);
                if ($key == count($get_terms) - 1) {
                    $display_term .= esc_html($get_term->name);
                } else {
                    $display_term .= esc_html($get_term->name) . ', ';
                }
            }
开发者ID:pranonTeam,项目名称:pranon_wp_development,代码行数:29,代码来源:single-portfolio.php

示例15: cftl_tax_landing_extras_box

function cftl_tax_landing_extras_box($post)
{
    wp_nonce_field(plugin_basename(__FILE__), 'cftl_tax_landing_extras_nonce');
    $taxonomy_array = get_the_taxonomies($post);
    if (!empty($taxonomy_array)) {
        $taxonomy_links = implode('<br/>', $taxonomy_array);
    } else {
        $taxonomy_links = __("No taxonomies specified.", 'cf-tax-landing');
    }
    $page_template = get_post_meta($post->ID, '_wp_page_template', true);
    ?>
<div class="form-field">
	<label for="cftl_page_template"><?php 
    _e('Page Template', 'cf-tax-landing');
    ?>
</label>
	<select name="cftl_page_template" id="cftl_page_template">
		<option value=""<?php 
    echo empty($page_template) ? ' selected="selected"' : '';
    ?>
><?php 
    _e('No Template (Use Post Templates)', 'cf-tax-landing');
    ?>
</option>
		<option value="default"<?php 
    echo "default" == $page_template ? ' selected="selected"' : '';
    ?>
><?php 
    _e('Default (Page) Template', 'cf-tax-landing');
    ?>
</option>
		<?php 
    page_template_dropdown($page_template);
    ?>
	</select>
</div>
<div class="form-field">
	<label><?php 
    _e('Current taxonomy links:', 'cf-tax-landing');
    ?>
</label><br/>
	<?php 
    echo $taxonomy_links;
    ?>
</div>
<?php 
}
开发者ID:NathanLawrence,项目名称:Largo,代码行数:47,代码来源:cftl-admin.php


注:本文中的get_the_taxonomies函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。