array (
'url' => "$ttw_dir/images/headers/ivorydrive.png",
'thumbnail_url' => "$ttw_dir/images/headers/ivorydrive-thumbnail.png",
'description' => __( 'Ivory Drive band example', $ttwTrans )
),
'indieave' => array (
'url' => "$ttw_dir/images/headers/indieave.png",
'thumbnail_url' => "$ttw_dir/images/headers/indieave-thumbnail.png",
'description' => __( 'Indie Ave 940x180 example', $ttwTrans )
),
'wpweaver' => array (
'url' => "$ttw_dir/images/headers/wpweaver.jpg",
'thumbnail_url' => "$ttw_dir/images/headers/wpweaver-thumbnail.jpg",
'description' => __( 'WPWeaver 940x140 Header', $ttwTrans )
),
'sopris' => array (
'url' => "$ttw_dir/images/headers/sopris.png",
'thumbnail_url' => "$ttw_dir/images/headers/sopris-thumbnail.png",
'description' => __( 'Sopris 940x198 Header', $ttwTrans )
)
));
## top widget area
register_sidebar( array (
'name' => __( 'TTW Top Widget Area', $ttwTrans ),
'id' => 'top-widget-area',
'description' => __( 'The top widget area', $ttwTrans ),
'before_widget' => '
',
'after_widget' => "",
'before_title' => '',
) );
## bottom widget area
register_sidebar( array (
'name' => __( 'TTW Bottom Widget Area', $ttwTrans ),
'id' => 'bottom-widget-area',
'description' => __( 'The bottom widget area', $ttwTrans ),
'before_widget' => '',
'after_widget' => "",
'before_title' => '',
) );
ttw_extended_setup();
$cur_theme = get_option('ttw_subtheme');
if ($cur_theme == '' && TTW_START_THEME != TTW_DEFAULT_THEME) st_set_subtheme(TTW_START_THEME);
}
function mytheme_add_admin() {
global $TTW_THEMENAME, $ttwTrans;
/* adds our admin panel */
if (TTW_MULTISITE) {
define('THEME_CAP','edit_theme_options'); /* allows non-superadmin admins to use theme options */
} else {
define('THEME_CAP','edit_themes'); /* don't want Twenty Ten Weaver to work on TTW_MULTISITE */
}
$page = add_theme_page($TTW_THEMENAME, $TTW_THEMENAME, THEME_CAP, basename(__FILE__), 'mytheme_admin');
/* using registered $page handle to hook stylesheet loading for this admin page */
add_action('admin_print_styles-'.$page, 'ttw_admin_scripts');
}
function ttw_admin_scripts() {
/* called only on the admin page, enqueue our special style sheet here (for tabbed pages) */
define('YETII',true);
define('ttw_nocookies',true);
wp_enqueue_style('ttwStylesheet', get_bloginfo('stylesheet_directory').'/ttw-admin-style.css');
wp_enqueue_script('ttwjscolor', get_bloginfo('stylesheet_directory').'/js/jscolor/jscolor.js');
if (YETII){
wp_enqueue_script('ttwyetii', get_bloginfo('stylesheet_directory').'/js/yetii/yetii-min.js');
} else {
if (ttw_nocookies) {
wp_enqueue_script('ttwtebbercookie', get_bloginfo('stylesheet_directory').'/js/tabber/tabber-hidestart.js');
} else {
wp_enqueue_script('ttwtebbercookie', get_bloginfo('stylesheet_directory').'/js/tabber/tabber-cookies.js');
}
wp_enqueue_script('ttwtebber', get_bloginfo('stylesheet_directory').'/js/tabber/tabber-minimized.js');
}
ttw_extended_admin_scripts();
}
function mytheme_admin() {
/* theme admin page */
/* This generates the startup script calls, etc, for the admin page */
global $TTW_THEMENAME, $ttwTrans, $options;
global $theme_options;
$ttw_dir = get_bloginfo('stylesheet_directory');
/* First, process any actions from the buttons */
if ($_POST['saveoptions']) {
echo ''.__("Twenty Ten Weaver main options saved.",$TTW_THEMENAME).'
';
foreach ($options as $value) {
update_option( $value['id'], $_POST[ $value['id'] ] );
}
foreach ($options as $value) {
if( isset( $_POST[ $value['id'] ] ) ) {
update_option( $value['id'], $_POST[ $value['id'] ] ); } else { delete_option( $value['id'] );
$ttwHeadOptions = $_POST[ $value['id'] ];
}
}
}
if ($_POST['saveadvanced']) {
echo ''.__("Twenty Ten Weaver advanced options saved.",$ttwTrans).'
';
update_option('ttw_head_opts', str_replace("\\", "", $_POST['ttw_head_opts']));
update_option('ttw_theme_head_opts', str_replace("\\", "", $_POST['ttw_theme_head_opts']));
update_option('ttw_end_opts', str_replace("\\", "", $_POST['ttw_end_opts']));
update_option('ttw_footer_opts', str_replace("\\", "", $_POST['ttw_footer_opts']));
update_option('ttw_header_insert', str_replace("\\", "", $_POST['ttw_header_insert']));
}
if ($_POST['setsubtheme'] || $_POST['setsubtheme2']) { /* seems like Mozilla doesn't like 2 sets of select inputs
on same page, so we make up 2 ids/names to use */
if ($_POST['setsubtheme']) $pID = 'ttw_subtheme';
else $pID = 'ttw_subtheme2';
$cur_subtheme = $_POST[ $pID]; /* must have been set to get here */
if ($cur_subtheme == '') $cur_subtheme = TTW_DEFAULT_THEME; /* but just in case */
update_option('ttw_subtheme', $cur_subtheme); /* and save it */
/* we will be resetting everything, no matter what, so clear 'em all from $options */
foreach ($options as $value) {
delete_option( $value['id'] );
}
/* Hmmm... what do we do? Clear EVERYTHING, or just the theme_head_opts? - Let's do only head_opts for now. */
foreach (array (/*'ttw_head_opts', 'ttw_footer_opts', 'ttw_end_opts', */ 'ttw_theme_head_opts') as $value) {
delete_option( $value ); /* these are the advanced options + special theme head opts */
}
/* now, if something other than TTW_DEFAULT_THEME theme, set all values for theme */
if ($cur_subtheme != TTW_DEFAULT_THEME)
st_set_subtheme($cur_subtheme);
$t = get_option('ttw_subtheme'); if ($t == '') $t = TTW_DEFAULT_THEME; /* did we save a theme? */
echo ''.__("Twenty Ten Weaver options reset to sub-theme: ",$ttwTrans).$t.
'. '.__('Remember to set Background color to match!',$ttwTrans).'
';
}
if ($_POST['savemytheme']) {
update_option('ttw_subtheme', "My Saved Theme"); /* and save it */
ttw_savemytheme();
echo ''.__('All current main and advanced options saved in My Saved Theme.',$ttwTrans).'
';
}
if ($_POST['exporttheme']) {
ttw_export_theme();
}
if ($_POST['uploadtheme']) {
if (ttw_upload_theme()) {
$t = get_option('ttw_subtheme'); if ($t == '') $t = TTW_DEFAULT_THEME; /* did we save a theme? */
echo ''.__("Twenty Ten Weaver options reset to uploaded theme, saved as: ",$ttwTrans).$t.
'. '.__('Remember to set Background color to match!',$ttwTrans).'
';
} else {
echo (''.
__('INVALID THEME URL PROVIDED - Try Again',$ttwTrans).'
');
}
}
if ($_POST['ttw_save_extension']) { /* for theme extensions */
ttw_save_extension();
}
?>
Options
'); /* and add the extended option admin tab if exists */ ?>
'); /* and add the extended option admin tab if exists */ ?>
Preview of site. Displays current look after you save options or select sub-theme.
\n");
/* here, we output our style sheet overrides */ ?>
\n");
} /* end mytheme_wp_head */
function childtheme_set_hi_height($def) {
global $TTW_THEMENAME, $options;
/* filter to change the height of the default header image */
$val = t_get_text_option_value("ttw_header_image_height");
return (int) $val;
}
/*
* Prints HTML with meta information for the current post (category, tags and permalink).
* We've completely rewritten this to correspond to our CSS tags
* @since Twenty Ten 1.0
*/
function twentyten_posted_in() {
// Retrieves tag list of current post, separated by commas.
$tag_list = get_the_tag_list( '', ', ' );
if ( $tag_list ) {
$posted_in =
__( 'This entry posted in %1$s. Entry Tags: %2$s Bookmark the permalink. ', TTW_TRANS );
} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
$posted_in =
__( 'This entry posted in %1$s. Bookmark the permalink. ', TTW_TRANS );
} else {
$posted_in = __( 'Bookmark the permalink. ', TTW_TRANS );
}
// Prints the string, replacing the placeholders.
printf(
$posted_in,
get_the_category_list( ', ' ),
$tag_list,
get_permalink(),
the_title_attribute( 'echo=0' )
);
}
require_once("ttw-options.php"); /* add the rest of our files */
require_once("ttw-advancedopts.php");
require_once("ttw-help.php");
require_once("ttw-subthemes.php");
require_once("ttw-extend.php");
if (!TTW_IS_CHILD)
require_once("2010functions.php"); /* load the parent */
/* This is where the theme hooks into the rest of Wordpress */
add_filter('twentyten_header_image_height', 'childtheme_set_hi_height');
add_action('after_setup_theme', 'weaver2010_setup' );
add_action('wp_head', 'mytheme_wp_head');
add_action('admin_menu', 'mytheme_add_admin');
?>