示例#1
0
function register_taxonomies()
{
    foreach (applied_taxonomies() as $tax) {
        $uctax = ucwords($tax);
        register_taxonomy($tax, array('post', 'page'), array('labels' => array('name' => _x($uctax, 'taxonomy general name'), 'singular_name' => _x($uctax, 'taxonomy singular name'), 'search_items' => __('Search ' . $uctax . 's'), 'all_items' => __('All ' . $uctax . 's'), 'edit_item' => __('Edit ' . $uctax), 'update_item' => __('Update ' . $uctax), 'add_new_item' => __('Add New ' . $uctax), 'new_item_name' => __('New ' . $uctax . ' Name'), 'separate_items_with_commas' => __('Separate ' . $tax . 's with commas'), 'add_or_remove_items' => __('Add or remove ' . $tax . 's'), 'choose_from_most_used' => __('Choose from the most used ' . $tax . 's'), 'not_found' => __('No ' . $tax . 's found'), 'menu_name' => __($uctax . 's')), 'show_ui' => true, 'show_admin_column' => true, 'rewrite' => array('slug' => $tax)));
    }
}
示例#2
0
文件: core.php 项目: rd4k1/Lewdism
function get_the_details($post = 0)
{
    $post = get_post($post);
    $id = isset($post->ID) ? $post->ID : 0;
    $meta = get_post_meta($id, 'details', true) ? get_post_meta($id, 'details', true) : array();
    $terms = array();
    foreach (wp_get_post_terms($id, applied_taxonomies()) as $arr) {
        if (!isset($terms[$arr->taxonomy])) {
            $terms[$arr->taxonomy] = '<a href="' . get_term_link($arr) . '">' . $arr->name . '</a>';
        } else {
            $terms[$arr->taxonomy] .= ', <a href="' . get_term_link($arr) . '">' . $arr->name . '</a>';
        }
    }
    if (!empty(array_merge($meta, $terms))) {
        return array_merge($meta, $terms);
    }
    return;
}