-
-
Save upcesar/c65424c62b89646f5170 to your computer and use it in GitHub Desktop.
Modificando Wordpress para criar post type e suas taxonomy...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*=================================== | |
= Posts Types = | |
===================================*/ | |
/*========== Exemplo ==========*/ | |
function exemplo() { | |
$args = array( | |
'labels' => array('name' => 'exemplo', 'add_new' => 'Adicionar'), | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'query_var' => true, | |
'exclude_from_search' => true, | |
'rewrite' => array( 'slug' => 'exemplo' ), | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => true, | |
'taxonomies' => array('categoria-exemplo'), | |
'menu_position' => 2, | |
'supports' => array( 'title', 'editor', 'tags', 'author', 'revisions', 'excerpt', 'comments', 'page-attributes' ) | |
); | |
register_post_type( 'exemplo', $args ); | |
flush_rewrite_rules(); | |
} | |
add_action( 'init', 'exemplo' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$args = array( | |
'hierarchical' => true, | |
//'labels' => $labels, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'update_count_callback' => '_update_post_term_count', | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'categoria-exemplo' ), | |
'exclude_from_search' => false, | |
'publicly_queryable' => true, | |
'public' => true, | |
); | |
register_taxonomy( 'categoria-exemplo', 'exemplo', $args ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment