2013-06-25 44 views
0

我有一個名爲'Jobs'的自定義發佈類型。自定義帖子類型具有自定義分類,稱爲「位置」。get_the_term_list只能獲得一個術語

在作業頁面上,顯示作業發佈對應的位置。即一項工作可能在上海和北京有職位。

要嘗試證明這一點,我寫了下面 - >

<?php 
    echo '<ul class="opp_location">'; 
    echo get_the_term_list($post->ID, 'locations', '<li>', ',</li><li>', '</li>'); 
    echo '</ul>'; 
?> 

但是,如果招聘廣告中只有一個詞,沒有什麼產出。

但是,當我有兩個詞,第二學期的產出。

如果我有三個術語,仍然只有第二學期的輸出。

我不太確定這裏發生了什麼事。我該如何做到這一點,以便屬於這篇文章的自定義分類中的所有術語都顯示出來了?

下面是functions.php中的分類代碼 - >

add_action('init', 'register_taxonomy_locations'); 

function register_taxonomy_locations() { 

    $labels = array( 
     'name' => _x('Locations', 'locations'), 
     'singular_name' => _x('Location', 'locations'), 
     'search_items' => _x('Search Locations', 'locations'), 
     'popular_items' => _x('Popular Locations', 'locations'), 
     'all_items' => _x('All Locations', 'locations'), 
     'parent_item' => _x('Parent Location', 'locations'), 
     'parent_item_colon' => _x('Parent Location:', 'locations'), 
     'edit_item' => _x('Edit Location', 'locations'), 
     'update_item' => _x('Update Location', 'locations'), 
     'add_new_item' => _x('Add New Location', 'locations'), 
     'new_item_name' => _x('New Location', 'locations'), 
     'separate_items_with_commas' => _x('Separate locations with commas', 'locations'), 
     'add_or_remove_items' => _x('Add or remove locations', 'locations'), 
     'choose_from_most_used' => _x('Choose from the most used locations', 'locations'), 
     'menu_name' => _x('Locations', 'locations'), 
    ); 

    $args = array( 
     'labels' => $labels, 
     'public' => true, 
     'show_in_nav_menus' => true, 
     'show_ui' => true, 
     'show_tagcloud' => true, 
     'show_admin_column' => true, 
     'hierarchical' => true, 

     'rewrite' => true, 
     'query_var' => true 
    ); 

    register_taxonomy('locations', array('job'), $args); 
} 

回答

0

OHP,好像分類中的第一個2項條款未予承認。我嘗試重新添加它們,並修復它。