Support » Fixing WordPress » Theme Option Problem with WP 2.8

  • Resolved logicstar


    Hello.. I just upgrading wordpress 2.8
    i found some problem on theme option page.
    on the theme option page, When I edit the theme options and save the changes then all categories selections are gone and categories doesn’t show anymore.
    is someone can help me?

    thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • i use my own theme,
    and this is the code of the option page (for the categories select only)

    $themename = “My-Theme”;
    $shortname = “nm”;
    $nm_categories_obj = get_categories(‘hide_empty=0’);
    $nm_categories = array();
    foreach ($nm_categories_obj as $nm_cat) {
    $nm_categories[$nm_cat->cat_ID] = $nm_cat->cat_name;
    $categories_tmp = array_unshift($nm_categories, “Category Name:”);
    $number_entries = array(“Select a Number:”,”1″,”2″,”3″,”4″,”5″,”6″);

    $options = array (

    array( “name” => “Select Category for Featured Posts”,
    “id” => $shortname.”_slide_category”,
    “std” => “Select a category:”,
    “type” => “select”,
    “options” => $nm_categories),

    if i select categories for featured posts and hit save button.
    the categories will be disapear and the it is not workin at all

    Are you using a WooTheme? We are offering support to all the themes with the new upgrades to WordPress 2.8. This happens to be one of the problems. 😛

    oh no.. i use my own theme 🙂
    not using any WooTheme

    Well I guess I could tell you what the problem is.

    You have to wrap the entire snippet in a function, presuming that your code is in the root of your functions.php file or other.

    Then call the function on the wordpress ‘init’ hook, add_action(‘init’,’theme_option’);

    As follow:

    function options_function(){
    $themename = "My-Theme";
    $shortname = "nm";
    $nm_categories_obj = get_categories('hide_empty=0');
    $nm_categories = array();
    foreach ($nm_categories_obj as $nm_cat) {
    $nm_categories[$nm_cat->cat_ID] = $nm_cat->cat_name;
    $categories_tmp = array_unshift($nm_categories, "Category Name:");
    $number_entries = array("Select a Number:","1","2","3","4","5","6");
    $options = array (
    array( "name" => "Select Category for Featured Posts",
    "id" => $shortname."_slide_category",
    "std" => "Select a category:",
    "type" => "select",
    "options" => $nm_categories),

    Then reference the $options like so:

    $options = get_option('theme_options');
    foreach ($option as $option){

    Hope that helps.

    I got the same problem…this must be a wp2.8 bug.

    anyway I found a solution…

    added this to the mytheme_add_admin function after the global declarations (I guess u r using the same options template).

    foreach (get_categories() as $cat) $cats[] = $cat->cat_name;
    $options[0]["options"] = $cats;

    Where the 0 is the position in the options array.

    thank you wpcoda,
    but it is still not working.
    the posible solution on my theme is change the “select” option into
    “write” option.
    so i change the dropdown list of catgeories into manual writing to show the categories 🙂

    i am still try to find best solution.

    any idea with my theme option ?

    @ foxinni ( )’s works..
    Thank you So much for your help…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Theme Option Problem with WP 2.8’ is closed to new replies.