![]() |
Adding 2nd WP Custom Taxonomy?
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 |
Quote:
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 |
I don't have skype, it's easier for me to just do it in here anyway since I can come back to it whenever it is convenient for me.
I think I get what you are saying though. However since I'm not familiar with PHP, I don't know where exactly I'm going to be putting the code, or even what the necessary chunk of code is. Can you show me exactly what part of the code needs to be copied and where it goes? |
i really dont know the full picture but I guess you could do a couple things
I suppose you could go to the other function declaration you did to add taxonomy and just register the model taxonomy in that one or if you want to just keep what you have for simplicity or whatever rename this add_custom_taxonomies to addModelTaxonomy() then use addModelTaxonomy in your init add_action( 'init', 'addModelTaxonomy'); i suppose its a workaround way but might be simplest for you I don't really want to get too deep into this |
Well, the model taxonomy is the one I have already added, the one that functions. I'm just trying to add a new one. Again, I'm entirely unfamiliar with PHP, so I'd have to actually see the final / correct code in order to understand.
|
Simply add following code to your functions.php in theme folder:
Code:
function some_custom_taxonomy_init() { <put_your_taxonomy_slug_here> - change this (this will be displayed in link domain.com/this_taxonomy/) note: this taxonomy will be added to default post type (Post) name of the functions must be unique, now is "some_custom_taxonomy_init" |
Thanks for the clarification. I get what you mean. I'm now able to add that taxonomy, however, now I get this error at the top of my screen:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/42/10173742/html/wp-content/themes/adultphoto-01-pink/functions.php:168) in /home/content/42/10173742/html/wp-content/plugins/easy-batch-uploader-0.4.0/class-main.php on line 135 It's interfering with a custom plugin. I e-mailed the guy who made it, still waiting for a reply - but figured I'd mention it here too. Do you guys think this is a problem with the taxonomy I made, or with the plugin? Considering my other custom taxonomy didn't interfere with the plugin, I'm thinking I'm still doing something wrong with the new one. This is the code that I have added: Code:
<?php |
There's nothing wrong with the taxonomy. The error means that you have printed something out before the headers were sent meaning that there's some kind of print/echo command in your functions.php file... check the error code lines.
|
I manged to fix it by combining the two custom taxonomy chunks into one chunk of php code, I think. Basically took out the closing tags of the first one, and the opening tags of the second. Corresponded to the line error, so I guess that was it.
Now I'm getting an error when I try to use get_the_term_list to display the taxonomy on a page. : Catchable fatal error: Object of class WP_Error could not be converted to string in /home/content/42/10173742/html/wp-content/themes/adultphoto-01-pink/single.php on line 45 The code is: Code:
<div class="image-site"><?php Thanks for being patient with me, this php stuff is just way over my head, difficult to grasp. |
Bump. Anyone?
|
Anyone? Still getting this error. I also can't view the results for that archive page. If I go to a term that I know has posts in it, it still says there were no results.
|
Figured it all out. For anyone who finds this post who has similar problems, find an auto taxonomy code generator, just so you can be sure you aren't messing anything up yourself. Then refresh the permalink structure. That fixed everything for me. Such an easy fix, just had to find it.
|
All times are GMT -7. The time now is 06:03 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123