Custom taxonomies in theme option page.
-
I have created a custom taxonomy called ‘genre’. I have terms like scifi, Comedy, Drama , action etc, under this ‘genre’ taxonomy.
I am trying to make a custom taxonomy selection option in my theme option page so that I can query post with any specific term in that custom taxonomy. I have been trying to get this done using the get_terms function.
The code I came up with is this,
$zm_terms_obj = get_terms('genre') ;//genre is the name of my custom taxonomy $zm_terms = array(); foreach ($zm_terms_obj as $zm_term) { $zm_terms[$zm_term->term_id]=$zm_term->name; } $terms_tmp = array_unshift( $zm_terms, "Select a genre:");
and for option
array( "name" => "Movie Genre", "desc" => "", "id" => $shortname."_mgenre", "std" => "Select a genre:", "type" => "select", "options" => $zm_terms),
Now when I go to the theme option page and try to select a genre it is supposed to list options like scifi, comedy, drama, action. But I find the select field blank. No terms are listed.
Anyone else facing a similar issue? and any suggestions are most welcome.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom taxonomies in theme option page.’ is closed to new replies.