Hi I made a theme options by this tutorial
This options have multicheck type by checkboxes. I don’t know how to make it work. I’m try to exclude page using this multicheck.
This is my array with options:
$pages = get_pages('sort_column=post_parent,menu_order');
$pageids = array();
foreach ($pages as $page) {
$pageids[$page->ID]= $page->post_title;
}
array( "name" => "Exclude page",
"desc" => "",
"id" => $shortname."_excludepage",
"type" => "multicheck",
"options" => $pageids,
"std" => ""),
This screen show how this function looks in my DB:
http://i.stack.imgur.com/QFwV7.png
512
is the ID of a page that I try to exclude.
Look’s like this in admin:
http://i.stack.imgur.com/31TQa.png
In my template I’ve use this standart method for exclusion:
wp_list_pages("exclude=get_option('src_excludepage'));
Please help me with this function! Thank you!
Want some honest advice? Work from a better code base..
Though, it’s not your fault, there are hundreds of blogs with variations of similar code, i’m not sure where it originated, but i see similar code “alot”…
If you can get by without the hand holding and just manage with a good code base, i’d suggest the following..
http://themeshaper.com/sample-theme-options/
It’s not the most fancy or advanced example, but the approach is sound, it only uses a single option to store all the values and also uses the settings api for handling options.
Assuming your back-end works, and you can check multiple fields, and that the field values are really stored as an array, use:PS: the tutorial you use has a pretty weird way of handling “multicheck”. A much easier method is to append
[]
to the checkbox input names…Update:
in the
mytheme_admin()
function add another case:in the
$options
array remove the old option and add:now, theoretically my code above should work…