WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom taxonomies in theme option page. (2 posts)

  1. jinsona
    Member
    Posted 3 years ago #

    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.

  2. marksouthard
    Member
    Posted 3 years ago #

    I am facing a similar problem, and am hoping that you've found a solution are willing to post.

Topic Closed

This topic has been closed to new replies.

About this Topic