<?php
load_theme_textdomain('eno', TEMPLATEPATH . '/languages/');
include(TEMPLATEPATH."/functions/breadcrumb-trail.php");
add_filter('comments_template', 'legacy_comments');
function legacy_comments($file) {
if(!function_exists('wp_list_comments')) : // WP 2.7-only check
$file = TEMPLATEPATH . '/legacy.comments.php';
endif;
return $file;
}
if ( function_exists('register_sidebars') ) {
register_sidebar(array('name'=>'Sidebar','before_title'=>'
','after_title'=>'
'));
register_sidebar(array('name'=>'Widget Footer Left','before_title'=>'
','after_title'=>'
'));
register_sidebar(array('name'=>'Widget Footer Middle','before_title'=>'
','after_title'=>'
'));
register_sidebar(array('name'=>'Widget Footer Right','before_title'=>'
','after_title'=>'
'));
}
function the_content_limit($max_char, $more_link_text = '[....]', $stripteaser = 0, $more_file = '') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$content = strip_tags($content);
if (strlen($_GET['p']) > 0) {
echo "
";
echo $content;
echo " <a href='";
the_permalink();
echo "'>[....]";
echo "
";
}
else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
$content = substr($content, 0, $espacio);
$content = $content;
echo "
";
echo $content;
echo " ";
echo " <a href='";
the_permalink();
echo "'>[....]";
echo "
";
}
else {
echo "
";
echo $content;
echo " <a href='";
the_permalink();
echo "'>[....]";
echo "
";
}
}
$themename = "Spooky";
$shortname = "spk";
$options = array (
array(
"type" => "open"),
array(
"name" => __('Setting up your Theme Options', 'eno'),
"type" => "title"),
array(
"type" => "open"),
array(
"name" => __('Choose between Image Logo or Text', 'eno'),
"type" => "title"),
array(
"name" => __('Image Logo instead of Text?', 'eno'),
"id" => $shortname."_logo_text",
"desc" => __('Click here if you want an image logo instead of text (source file included)', 'eno'),
"type" => "checkbox",
"std" => "false"),
array(
"type" => "submit"),
array(
"type" => "close"),
array(
"type" => "open"),
array(
"name" => __('Setup Your Follow Me On Twitter Button', 'eno'),
"type" => "title"),
array(
"name" => __('Your Twitter Username', 'eno'),
"desc" => __('Type in your twitter username for the Follow Me on Twitter Button', 'eno'),
"id" => $shortname."_twitter_name",
"type" => "text",
"std" => "wordpress"),
array(
"name" => __('Hide the Follow Me on Twitter Button?', 'eno'),
"desc" => __('Check this box if you don't want the Follow Me on Twitter Button in the Sidebar.', 'eno'),
"id" => $shortname."_sidebar_twitter",
"type" => "checkbox",
"std" => "false"),
array(
"type" => "submit"),
array(
"type" => "close"),
);
function mytheme_add_admin() {
global $themename, $shortname, $options;
if ( $_GET['page'] == basename(__FILE__) ) {
if ( 'save' == $_REQUEST['action'] ) {
foreach ($options as $value) {
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'] ); } }
header("Location: themes.php?page=functions.php&saved=true");
die;
} else if( 'reset' == $_REQUEST['action'] ) {
foreach ($options as $value) {
delete_option( $value['id'] ); }
header("Location: themes.php?page=functions.php&reset=true");
die;
}
}
add_theme_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
function mytheme_admin() {
global $themename, $shortname, $options;
if ( $_REQUEST['saved'] ) echo '
'.$themename.' settings saved.
';
if ( $_REQUEST['reset'] ) echo '
'.$themename.' settings reset.
';
?>
<?php foreach ($options as $value) {
switch ( $value['type'] ) {
case "open":
?>
<div style="width:90%; background:#eee; border:1px solid #ddd; padding:20px; overflow:hidden; display: block; margin: 0px 0px 10px; -moz-border-radius: 10px;
-webkit-border-radius: 10px;">
<?php break;
case "close":
?>
<?php break;
case "misc":
?>
<?php break;
case "title":
?>
<?php break;
case 'text':
?>
<img style="padding:5px; background:#FFF; border:1px solid #ddd;" src="/images/" alt="image" />
<input style="width:200px;" name="" id="" type="" value="" />
<?php
break;
case 'textarea':
?>
<img style="padding:5px; background:#FFF; border:1px solid #ddd;" src="/images/" alt="image" />
<textarea name="" style="width:400px; height:200px; margin-top:10px" type="" cols="" rows="">
<?php
break;
case 'select':
?>
<img style="padding:5px; background:#FFF; border:1px solid #ddd;" src="/images/" alt="image" />
<select style="width:240px;" name="" id=""><option>
<?php
break;
case "checkbox":
?>
<img style="padding:5px; background:#FFF; border:1px solid #ddd;" src="/images/" alt="image" />
<input type="checkbox" name="" id="" value="true" />
<?php
break;
case "submit":
?>
<input name="save" type="submit" value="" />
<?php break;
}
}
?>
<?php
}
add_action('admin_menu', 'mytheme_add_admin');
/*End of Add a Theme Options Page*/
/*End of Theme Options =======================================*/
// Remove WP Generator for security reasons
remove_action('wp_head', 'wp_generator');
?>