SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wicked Wordpress - Admin Panel

    Hey,

    I have been trying to add an Options Panel for my child theme following the book Wicked Wordpress Themes. I have used the same code as in the book, but I cant get the admin Panel to show up in the appearance menu. Anyone know what the problem is and how to fix it?

    Thanks!

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,606
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    As far as I'm aware, when the book was published, wordpress 3.0 was the current version of wordpress, rather than the version that is in the wild right now: version 3.2. So, there may be some discrepancies in that regard.

    Go ahead and post what code you have.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On my last try I used the excact same code as in the book:

    <?php

    // Set some theme specific variables for the options panel
    $childthemename = "Wicked Theme";
    $childshortname = "wt";
    $childoptions = array();

    function childtheme_options() {
    global $childthemename, $childshortname, $childoptions;

    // Create array to store the Categories to be used in the drop-down select box
    $categories_obj = get_categories('hide_empty=0');
    $categories = array();
    foreach ($categories_obj as $cat) {
    $categories[$cat->cat_ID] = $cat->cat_name;
    }

    $childoptions = array (

    array( "name" => __('Link Color','thematic'),
    "desc" => __('Change the color of links by entering a HEX color number. (e.g.: 003333)','thematic'),
    "id" => "wicked_link_color",
    "std" => "999999",
    "type" => "text"
    ),
    array( "name" => __('Show Header Image','thematic'),
    "desc" => __('Show an image in the header. Replace the header.png file found in the /wicked/images/ folder with your own image, up to 120x100px.','thematic'),
    "id" => "wicked_show_logo",
    "std" => "false",
    "type" => "checkbox"
    ),
    array( "name" => __('Featured Category','thematic'),
    "desc" => __('A category of posts to be featured on the front page.','thematic'),
    "id" => "wicked_feature_cat",
    "std" => $default_cat,
    "type" => "select",
    "options" => $categories
    )
    );
    }
    add_action('init', 'childtheme_options');

    // Make a Theme Options Page
    function childtheme_add_admin() {
    global $childthemename, $childshortname, $childoptions;

    if ( $_GET['page'] == basename(__FILE__) ) {

    if ( 'save' == $_REQUEST['action'] ) {
    // protect against request forgery
    check_admin_referer('childtheme-save');
    // save the options
    foreach ($childoptions as $value) {
    if( isset( $_REQUEST[ $value['id'] ] ) ) {
    update_option( $value['id'], $_REQUEST[ $value['id'] ] );
    } else {
    delete_option( $value['id'] );
    }
    }

    // return to the options page
    header("Location: themes.php?page=options.php&saved=true");
    die;

    } else if ( 'reset' == $_REQUEST['action'] ) {
    // protect against request forgery
    check_admin_referer('childtheme-reset');
    // delete the options
    foreach ($childoptions as $value) {
    delete_option( $value['id'] );
    }

    // return to the options page
    header("Location: themes.php?page=options.php&reset=true");
    die;
    }
    }
    add_theme_page($childthemename." Options", "$childthemename Options", 'edit_themes', basename(__FILE__), 'childtheme_admin');
    }
    add_action('admin_menu' , 'childtheme_add_admin')
    ?>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •