'
));
if (function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Footer'
));
if(function_exists('add_theme_support')) {
add_theme_support( 'post-thumbnails' );
}
function get_custom_field_value($szKey, $bPrint = false) {
global $post;
$szValue = get_post_meta($post->ID, $szKey, true);
if ( $bPrint == false ) return $szValue; else echo $szValue;
}
add_action('publish_page', 'add_custom_field_automatically');
add_action('publish_post', 'add_custom_field_automatically');
function add_custom_field_automatically($post_ID) {
global $wpdb;
if(!wp_is_post_revision($post_ID)) {
add_post_meta($post_ID, 'slider', 'put your slider image url here(573x223)', true);
add_post_meta($post_ID, 'summary', 'put your post summary here(only for Easyslider)', true);
}
}
function the_thumb($size = "medium", $add = "") {
global $wpdb, $post;
$thumb = $wpdb->get_row("SELECT ID, post_title FROM {$wpdb->posts} WHERE post_parent = {$post->ID} AND post_mime_type LIKE 'image%' ORDER BY menu_order");
if(!empty($thumb)) {
$image = image_downsize($thumb->ID, $size);
print "

";
}
}
function wpe_excerptlength_teaser($length) {
return 45;
}
function wpe_excerptlength_index($length) {
return 12;
}
function wpe_excerptmore($more) {
return '...';
}
function wpe_excerpt($length_callback='', $more_callback='') {
global $post;
if(function_exists($length_callback)){
add_filter('excerpt_length', $length_callback);
}
if(function_exists($more_callback)){
add_filter('excerpt_more', $more_callback);
}
$output = get_the_excerpt();
$output = apply_filters('wptexturize', $output);
$output = apply_filters('convert_chars', $output);
$output = '
'.$output.'
';
echo $output;
}
function getImage($num) {
global $more;
$more = 1;
$content = get_the_content();
$count = substr_count($content, '
![]()
');
$postOutput = substr($post, 0, $imgEnd+1);
$image[$i] = $postOutput;
$start=$imgEnd+1;
$cleanF = strpos($image[$num],'src="')+5;
$cleanB = strpos($image[$num],'"',$cleanF)-$cleanF;
$imgThumb = substr($image[$num],$cleanF,$cleanB);
}
if(stristr($image[$num],'
![]()
/i', $post->post_content, $matches); $first_img = $matches [1] [0]; $not_broken = @fopen("$first_img","r"); if(empty($first_img) || !($not_broken)){ unset($first_img); } else { $first_img = str_replace($url, '', $first_img); } return $first_img; }
function amp_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
id="li-comment-">
comment_approved == '0') : ?>
id="li-comment-">
cat_ID] = $amp_cat->category_nicename;
}
$categories_tmp = array_unshift($amp_categories, "Select a category:");
$number_entries = array("Select a Number:","1","2","3","4","5","6","7","8","9","10" );
$options = array(
array(
"type" => "open",
"id" => $shortname."_temp",
"std" => ""
),
array( "name" => "General",
"type" => "section","id" => $shortname."_temp","std" => ""),
array(
"name" => "Styles",
"type" => "select",
"id" => $shortname."_style",
"desc" => "Select a style from the list",
"options" => array("Water","No Style"),
"std" => "Water"
),
array(
"name" => "Fonts",
"type" => "select",
"id" => $shortname."_fonts",
"desc" => "Select a font from the list",
"options" => array("Lobster","Arial" ),
"std" => "Lobster",
),
array(
"name" => "Use timThumb?(requires PHP 4.3+ & GD Library)",
"type" => "checkbox",
"id" => $shortname."_thumb",
"std" => "false"
),
array(
"name" => "Show the full Content instead of the excerpt of the posts in index,archive and search page?",
"type" => "checkbox",
"id" => $shortname."_content",
"std" => "false"
),
array(
"name" => "Display Blog Description?",
"type" => "checkbox",
"id" => $shortname."_description",
"std" => "false"
),
array(
"type" => "close_sp",
"id" => $shortname."_temp","std" => ""),
array(
"name" => "Homepage",
"id" => $shortname."_temp",
"type" => "section","std" => ""
),
array(
"name" => "Hide all 4 blocks?",
"type" => "checkbox",
"id" => $shortname."_hide_blocks",
"std" => "false"
),
array(
"type" => "blocks","id" => $shortname."_temp","std" => ""),
array(
"name" => "Block1 Category",
"desc" => "Select the category for Block1",
"id" => $shortname."_block1_cat",
"type" => "select",
"std" => "Select a category",
"options" => $amp_categories),
array(
"name" => "Block2 Category",
"desc" => "Select the category for Block2",
"id" => $shortname."_block2_cat",
"type" => "select",
"std" => "Select a category",
"options" => $amp_categories),
array(
"name" => "Block3 Category",
"desc" => "Select the category for Block3",
"id" => $shortname."_block3_cat",
"type" => "select",
"std" => "Select a category",
"options" => $amp_categories),
array(
"name" => "Block4 Category",
"desc" => "Select the category for Block4",
"id" => $shortname."_block4_cat",
"type" => "select",
"std" => "Select a category",
"options" => $amp_categories),
array( "type" => "close_sp","id" => $shortname."_temp","std" => ""),
array(
"name" => "Slider",
"id" => $shortname."_temp",
"type" => "section","std" => ""
),
array(
"name" => "Slider Category",
"desc" => "Select the category for slider",
"id" => $shortname."_slider_cat",
"type" => "select",
"std" => "Select a category",
"options" => $amp_categories),
array(
"name" => "Slider Posts Count",
"desc" => "How many posts you want to show in slider?",
"id" => $shortname."_slider_count",
"type" => "select",
"std" => "3",
"options" => $number_entries),
array(
"name" => "Hide the Featured Ribbon?",
"type" => "checkbox",
"id" => $shortname."_ribbon",
"std" => "false"
),
array(
"type" => "close_sp",
"id" => $shortname."_temp","std" => ""),
array(
"name" => "Social",
"type" => "section",
"id" => $shortname."_temp","std" => ""),
array(
"name" => "Hide all the Social Icons",
"id" => $shortname."_hide_social",
"type" => "checkbox",
"std" => ""),
array(
"type" => "social","id" => $shortname."_temp","std" => ""),
array(
"name" => "Hide Twitter Icon",
"desc" => "Check to hide Twitter icon. If not type your twitter url below:",
"id" => $shortname."_hide_tw",
"type" => "checkbox",
"std" => ""),
array(
"id" => $shortname."_tw_url",
"type" => "text2",
"desc" => "Type Your Twitter URL",
"std" => ""
),
array(
"name" => "Hide Facebook Icon",
"desc" => "Check to hide Facebook icon. If not type your Facebook url below:",
"id" => $shortname."_hide_fb",
"type" => "checkbox",
"std" => ""),
array(
"id" => $shortname."_fb_url",
"type" => "text2",
"desc" => "Type Your Facebook URL",
"std" => ""
),
array(
"name" => "Hide Myspace Icon",
"desc" => "Check to hide Myspace icon. If not type your Myspace url below:",
"id" => $shortname."_hide_ms",
"type" => "checkbox",
"std" => ""),
array(
"id" => $shortname."_ms_url",
"type" => "text2",
"desc" => "Type Your Myspace URL",
"std" => ""
),
array(
"name" => "Hide RSS Feed Icon",
"desc" => "Check to hide Feedburner icon. If not type your Feedburner url below:",
"id" => $shortname."_hide_rss",
"type" => "checkbox",
"std" => ""),
array(
"id" => $shortname."_rss_url",
"type" => "text2",
"desc" => "Type Your Feedburner URL",
"std" => ""
),
array(
"name" => "Hide Share Buttons From Posts?",
"type" => "checkbox",
"id" => $shortname."_hide_share",
"std" => "false"
),
array("type" => "share","id" => $shortname."_temp","std" => ""),
array(
"type" => "close_sp",
"id" => $shortname."_temp","std" => ""),
array(
"name" => "Documentation",
"type" => "section",
"id" => $shortname."_temp","std" => ""),
array(
"type" => "docum",
"id" => $shortname."_temp","std" => ""),
array(
"type" => "close_sp",
"id" => $shortname."_temp","std" => ""),
array(
"name" => "About",
"type" => "section",
"id" => $shortname."_temp","std" => ""),
array(
"type" => "about",
"id" => $shortname."_temp","std" => ""),
array(
"type" => "close_sp",
"id" => $shortname."_temp","std" => ""),
array(
"name" => "Upgrade",
"type" => "section",
"id" => $shortname."_temp","std" => ""),
array(
"type" => "upgrade",
"id" => $shortname."_temp","std" => ""),
array(
"type" => "close_sp",
"id" => $shortname."_temp","std" => ""),
array( "type" => "close","id" => $shortname."_temp","std" => "")
);
function mytheme_add_admin() {
global $themename, $shortname, $options;
$optionvar = array();
if ( isset($_GET['page']) && $_GET['page'] == basename(__FILE__) ) {
if ( isset($_REQUEST['action']) && 'save' == $_REQUEST['action'] ) {
foreach ($options as $value) {
if (isset($_REQUEST[ $value['id'] ])) {
update_option( $value['id'], $_REQUEST[ $value['id'] ] );
}
}
foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] );
}
}
update_option( $shortname."_options", $optionvar );
header("Location: themes.php?page=functions.php&saved=true");
die;
} else if( isset($_REQUEST['action']) && 'reset' == $_REQUEST['action'] ) {
foreach ($options as $value) {
delete_option( $value['id'] ); }
header("Location: themes.php?page=functions.php&reset=true");
die;
}
}
$file_dir=get_bloginfo('template_directory');
wp_enqueue_style("functions", $file_dir."/other.css", false, "1.0", "all");
wp_enqueue_script("amp_script", $file_dir."/js/amphion.js", false);
wp_enqueue_script("amp_otscript", $file_dir."/js/other.js", false);
add_theme_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
function mytheme_admin() {
global $themename, $shortname, $options, $option_values;
if ( isset($_REQUEST['saved']) && $_REQUEST['saved'] ) echo ''.$themename.' settings saved.
';
if ( isset($_REQUEST['reset']) && $_REQUEST['reset'] ) echo ''.$themename.' settings reset.
';
?>