- This topic is empty.
-
AuthorPosts
-
August 28, 2010 at 12:34 am #30080
Locke
Participanthello all
here I am diving into the new options of WordPress, but if you read all my last Threads I’m not good in php or wordpress funtions and etc…
So, the point here is that I ‘m trying to list all the taxonomies that I have for example:
This are my custom posts and taxonomies:
add_action( 'init', 'post_events' );
function post_events() {
register_post_type( 'events',
array(
'labels' => array(
'name' => __( 'Events' ),
'singular_name' => __( 'Events' ),
'add_new' => __( 'Add New Event' ),
'add_new_item' => __( 'Add New Event' ),
'edit' => __( 'Edit Item' ),
'edit_item' => __( 'Edit Event' ),
'new_item' => __( 'New Event' ),
'view' => __( 'View Events' ),
'view_item' => __( 'View Events' ),
'search_items' => __( 'Search Events' ),
'not_found' => __( 'No Events found' ),
'not_found_in_trash' => __( 'No Events found in Trash' ),
'parent' => __( 'Parent Events' ),
),
'public' => true,
'show_ui' => true,
'menu_icon' => get_stylesheet_directory_uri() . '/img/picture.png', // icon defined
'menu_position' => 5, // 5 - below Posts | 10 - below Media | 20 - below Pages
'hierarchical' => true,
'taxonomies'=> array('post_tag','tags'),
'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail' )
)
);
}
add_action( 'init', 'create_events_taxonomies');
function create_events_taxonomies() {
register_taxonomy( 'church', 'events', // in-case you do for commercial or free (such as foundation etc)
array(
'labels' => array (
'name' => 'Church Events',
'singular_name' => 'Church Event',
'search_items' => 'Search Church Events',
'popular_items' => 'Popular Church Events',
'all_items' => 'All Church Events',
'parent_item' => 'Parent Church Events',
'parent_item_colon' => 'Parent Church Events:',
'edit_item' => 'Edit Church Events',
'update_item' => 'Update Church Events',
'add_new_item' => 'Add New Church Event',
'new_item_name' => 'New Church Event Name'
),
'label' => 'Church Events',
'hierarchical' => true, // or true
'query_var' => 'church',
'show_ui' => 'true',
'show_tagcloud' => 'true',
'rewrite' => array('slug' => 'iglesia' ) )
);
register_taxonomy( 'garden-reception', 'events', // in-case you do for commercial or free (such as foundation etc)
array(
'labels' => array (
'name' => 'Garden and Reception Events',
'singular_name' => 'Garden and Reception Event',
'search_items' => 'Search Garden and Reception Events',
'popular_items' => 'Popular Garden and Reception Events',
'all_items' => 'All Garden and Reception Events',
'parent_item' => 'Parent Garden and Reception Events',
'parent_item_colon' => 'Parent Garden and Reception Events:',
'edit_item' => 'Edit Garden and Reception Events',
'update_item' => 'Update Garden and Reception Events',
'add_new_item' => 'Add New Garden and Reception Event',
'new_item_name' => 'New Garden and Reception Event Name'
),
'label' => 'Garden and Reception Events',
'hierarchical' => true, // or true
'query_var' => 'jardines-salones',
'show_ui' => 'true',
'show_tagcloud' => 'true',
'rewrite' => array('slug' => 'garden-reception' ) )
);
register_taxonomy( 'epergne', 'events', // in-case you do for commercial or free (such as foundation etc)
array(
'labels' => array (
'name' => 'Epergne Events',
'singular_name' => 'Epergne Event',
'search_items' => 'Search Epergne Events',
'popular_items' => 'Popular Epergne Events',
'all_items' => 'All Epergne Events',
'parent_item' => 'Parent Epergne Events',
'parent_item_colon' => 'Parent Epergne Events:',
'edit_item' => 'Edit Epergne Events',
'update_item' => 'Update Epergne Events',
'add_new_item' => 'Add New Epergne Event',
'new_item_name' => 'New Epergne Event Name'
),
'label' => 'Epergne Events',
'hierarchical' => true, // or true
'query_var' => 'epergne',
'show_ui' => 'true',
'show_tagcloud' => 'true',
'rewrite' => array('slug' => 'centros-mesa' ) )
);
}
then I’m trying to list all this taxonomies in home.
the way I’m using , obviously is not working hahaha :)) is:
//List Taxonomies
//Church
$taxonomy = 'church';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
$events1 = array(
'taxonomy' => $taxonomy,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title
);
?>
This display all the Tags inside Church ….
but what if I want to add all the Tags or Taxonomies of all my custom posts, do I need to repeat the $arg for every taxonomy or is there a good way to simplify this process??
hope someone can give a hand in this…
Thanks!
August 29, 2010 at 1:04 am #81774Locke
Participantwell dudes … I solve this .. hehe :)
I simplify my taxonomies only with 2…. and the code to display Taxonomies Tags outside the loop is pretty simple.. tag_cloud could make the work fine , but if you want to list the tags :
Eventos
'events', 'format'=>'list' ) ); ?>
Regalos
'gifts', 'format'=>'list' ) ); ?>
and that’s all
Thanks…
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.