06-28-2013, 11:53 AM
|
|
Confirmed User
Industry Role:
Join Date: May 2012
Posts: 124
|
Quote:
Originally Posted by Tittytweaker
I'm a bit confused. I've added a custom taxonomy called "models", and now I'm trying to add a new one, but when I do that I get this:
Fatal error: Cannot redeclare add_custom_taxonomies() (previously declared in /home/content/42/10173742/html/wp-content/themes/adultphoto-01-pink/functions.php:139) in /home/content/42/10173742/html/wp-content/themes/adultphoto-01-pink/functions.php on line 198
I'm sure this has to do with my lack of knowledge regarding PHP, I'm probably doing something wrong when I try to add it. Here is the code from my theme functions page as it is now:
Code:
<?php
/**
* Add custom taxonomies
*
* Additional custom taxonomies can be defined here
* http://codex.wordpress.org/Function_Reference/register_taxonomy
*/
function add_custom_taxonomies() {
// Add new "Model" taxonomy to Posts
register_taxonomy('model', 'post', array(
// Hierarchical taxonomy (like categories)
'hierarchical' => false,
// This array of options controls the labels displayed in the WordPress Admin UI
'labels' => array(
'name' => _x( 'Model', 'taxonomy general name' ),
'singular_name' => _x( 'Model', 'taxonomy singular name' ),
'search_items' => __( 'Search Model' ),
'all_items' => __( 'All Model' ),
'parent_item' => __( 'Parent Model' ),
'parent_item_colon' => __( 'Parent Model:' ),
'edit_item' => __( 'Edit Model' ),
'update_item' => __( 'Update Model' ),
'add_new_item' => __( 'Add New Model' ),
'new_item_name' => __( 'New Model Name' ),
'menu_name' => __( 'Model' ),
),
// Control the slugs used for this taxonomy
'rewrite' => array(
'slug' => 'model', // This controls the base slug that will display before each term
'with_front' => false, // Don't display the category base before "/model/"
'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
),
));
}
?>
I'm trying to add a taxonomy called "Site", and I'm basically just copying and pasting the same chunk of taxonomy code and changing everything to "site" instead of "model". Can anyone tell me what's happening / what I need to do?
|
dump the function declaration above because ut's already declared elsewhere so it is ready for you to use. There is no need for you to define the function again.
at second look just use register_taxonomy without wrapping it in a function to do what you want
do you have skype i will explain to you easier
|
|
|