name):
$mytags .= ', ' . $tags[$i]->name;
endif;
}
define('TAGLIST', $mytags);
add_filter( 'query_vars', 'add_my_var_main' );
function add_my_var_main($public_query_vars) {
$public_query_vars[] = 'searchform';
return $public_query_vars;
}
add_action( 'template_redirect', 'my_var_output_main' );
function my_var_output_main() {
$myvalue=get_query_var('searchform');
if ($myvalue) {
include( TEMPLATEPATH . '/functions/searchfield/searchfield.php' );
exit; // this stops WordPress entirely
}
}
$themename = "AdFormat";
$shortname = "af3";
// set the defaults..
$categories = get_categories('hide_empty=0&orderby=name');
$wp_cats = array();
foreach ($categories as $category_list ) {
$wp_cats[$category_list->cat_ID] = $category_list->cat_name;
}
array_unshift($wp_cats, "Choose a category");
$options = array (
array( "name" => $themename." Options",
"type" => "title" ),
array( "name" => "Size and Colours",
"type" => "section" ),
array( "type" => "open" ),
array( "name" => "Style width",
"desc" => "Select the width",
"id" => $shortname."_width",
"type" => "select",
"options" => array("default", "1024", "1280" ),
"std" => "default" ),
array( "name" => "Colour Scheme",
"desc" => "Select the colour scheme for the theme",
"id" => $shortname."_color_scheme",
"type" => "select",
"options" => array("red", "blue", "green" ),
"std" => "red" ),
array( "type" => "close" ),
array( "name" => "Adverts",
"type" => "section" ),
array( "type" => "open" ),
array( "name" => "Header adcode",
"desc" => "Add your header ad code here
(text links work best 728x15)",
"id" => $shortname."_ads_header",
"type" => "textarea",
"std" => '' ),
array( "name" => "footer adcode",
"desc" => "Add your footer ad code here (728x90)",
"id" => $shortname."_ads_footer",
"type" => "textarea",
"std" => "" ),
array( "name" => "sidebar top adcode",
"desc" => "Add your sidebar top ad code here (336x280)",
"id" => $shortname."_ads_top_sidebar",
"type" => "textarea",
"std" => "" ),
array( "name" => "sidebar adcode",
"desc" => "Add your sidebar ad code here (160x600)",
"id" => $shortname."_ads_sidebar",
"type" => "textarea",
"std" => "" ),
array( "type" => "close" ),
array( "name" => "Footer",
"type" => "section" ),
array( "type" => "open" ),
array( "name" => "Feedburner URL",
"desc" => "Feedburner is a Google service that takes care of your RSS feed. Paste your Feedburner URL here to let readers see it in your website",
"id" => $shortname."_feedburner",
"type" => "text",
"std" => get_bloginfo( 'rss2_url' ) ),
array( "type" => "close" )
);
function mytheme_add_admin() {
global $themename, $shortname, $options;
if ( initVar($_GET['page']) == basename(__FILE__) ) {
if ( 'save' == initVar($_REQUEST['action']) ) {
foreach ( $options as $value ) {
if ( isset( $value['id'] ) ):
set_theme_mod( $value['id'], $_REQUEST[ $value['id'] ] );
endif;
}
foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { set_theme_mod( $value['id'], initVar($_REQUEST[ $value['id'] ]) ); } else { remove_theme_mod( $value['id'] ); } }
header('Location: admin.php?page=adf3_func.php&saved=true');
die;
}
else if( 'reset' == $_REQUEST['action'] ) {
foreach ( $options as $value ) {
remove_theme_mod( $value['id'] ); }
header("Location: admin.php?page=adf3_func.php&reset=true");
die;
}
}
add_theme_page( $themename . ' Theme Options', $themename . ' Options', 'edit_themes', basename(__FILE__), 'mytheme_admin' );
//add_theme_page( $themename, 'AdFormat Settings', 8, 'adfoptions', 'mytheme_admin' );
}
function mytheme_add_init() {
$file_dir=get_bloginfo( 'template_directory' );
wp_enqueue_style( "functions", $file_dir."/functions/functions.css", false, "1.0", "all" );
wp_enqueue_script( "rm_script", $file_dir."/functions/rm_script.js", false, "1.0" );
}
function mytheme_admin() {
global $themename, $shortname, $options;
$i=0;
if ( initVar( $_REQUEST['saved'] ) ) echo ''.$themename.' settings saved.
';
if ( initVar( $_REQUEST['reset'] ) ) echo ''.$themename.' settings reset.
';
?>
To easily use the theme, you can use the menu below.