Pogledajte određenu poruku
Staro 19. 03. 2010.   #1
imenik
novi član
Na probnom radu
 
Datum učlanjenja: 23.01.2010
Poruke: 17
Hvala: 8
0 "Hvala" u 0 poruka
imenik is on a distinguished road
Red face Wordpress thema function.php POMOC!!!!!

Pozdrav svima

Pronasao sam jednu odlicnu temu za moj blog.Ali onaj sto je kreirao ovu temu je ubacio linkove u footer i provjeru da li su ti linkovi izbrisani u function.php.Sad ja ako izbrisem te linkove iz footera vraca mi gresku i to mi stvara probleme.Ja neznaam sta treba izbrisati iz function.php da bi ukinuo tu provjeru.Zato molim vas za pomoc jer sam ja jos noob u kodiranju.Function.php cu postati ovdje pa da vidite gdje se ta provjera nalazi i sta trebam izbrisati.Unaprijed zahvalan.

Kôd:
<?php
////////////////////////////////////////////////////////////////////////////////
// Get Featured Post Image
////////////////////////////////////////////////////////////////////////////////
function get_featured_slider_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
  $first_img = $matches [1] [0];

  if(empty($first_img)){ //Defines a default image
  	$img_dir = get_bloginfo('template_directory');
    $first_img = $img_dir . '/images/feat-default.jpg';
  }
  return $first_img;
}

////////////////////////////////////////////////////////////////////////////////
// Get Post Image
////////////////////////////////////////////////////////////////////////////////
function get_post_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
  $first_img = $matches [1] [0];

  if(empty($first_img)){ //Defines a default image
  	$img_dir = get_bloginfo('template_directory');
    $first_img = $img_dir . '/images/post-default.jpg';
  }
  return $first_img;
}

////////////////////////////////////////////////////////////////////////////////

// Featured Content Excerpt Post

////////////////////////////////////////////////////////////////////////////////

function the_featured_excerpt($excerpt_length=25, $allowedtags='', $filter_type='none', $use_more_link=true, $more_link_text="Read More", $force_more_link=true, $fakeit=1, $fix_tags=true) {

	if (preg_match('%^content($|_rss)|^excerpt($|_rss)%', $filter_type)) {

		$filter_type = 'the_' . $filter_type;

	}

	$text = apply_filters($filter_type, get_the_featured_excerpt($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit));

	$text = ($fix_tags) ? balanceTags($text) : $text;

	echo $text;

}

function get_the_featured_excerpt($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit) {

	global $id, $post;

	$output = '';

	$output = $post->post_excerpt;

	if (!empty($post->post_password)) { // if there's a password

		if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie

			$output = __('There is no excerpt because this is a protected post.');

			return $output;

		}

	}

	// If we haven't got an excerpt, make one.

	if ((($output == '') && ($fakeit == 1)) || ($fakeit == 2)) {

		$output = $post->post_content;

		$output = strip_tags($output, $allowedtags);

        $output = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $output );

		$blah = explode(' ', $output);

		if (count($blah) > $excerpt_length) {

			$k = $excerpt_length;

			$use_dotdotdot = 1;

		} else {

			$k = count($blah);

			$use_dotdotdot = 0;

		}

		$excerpt = '';

		for ($i=0; $i<$k; $i++) {

			$excerpt .= $blah[$i] . ' ';

		}


		if (($use_more_link && $use_dotdotdot) || $force_more_link) {

			$excerpt .= "...&nbsp;<a href=\"". get_permalink() . "#more-$id\">$more_link_text</a>";

		} else {

			$excerpt .= ($use_dotdotdot) ? '...' : '';

		}

		 $output = $excerpt;

	} // end if no excerpt

	return $output;

}

////////////////////////////////////////////////////////////////////////////////

// Standard Post Excerpt

////////////////////////////////////////////////////////////////////////////////

function the_post_excerpt($excerpt_length=50, $allowedtags='', $filter_type='none', $use_more_link=true, $more_link_text="Read More", $force_more_link=true, $fakeit=1, $fix_tags=true) {

	if (preg_match('%^content($|_rss)|^excerpt($|_rss)%', $filter_type)) {

		$filter_type = 'the_' . $filter_type;

	}

	$text = apply_filters($filter_type, get_the_post_excerpt($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit));

	$text = ($fix_tags) ? balanceTags($text) : $text;

	echo $text;

}

function get_the_post_excerpt($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit) {

	global $id, $post;

	$output = '';

	$output = $post->post_excerpt;

	if (!empty($post->post_password)) { // if there's a password

		if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie

			$output = __('There is no excerpt because this is a protected post.');

			return $output;

		}

	}

	// If we haven't got an excerpt, make one.

	if ((($output == '') && ($fakeit == 1)) || ($fakeit == 2)) {

		$output = $post->post_content;

		$output = strip_tags($output, $allowedtags);

        $output = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $output );

		$blah = explode(' ', $output);

		if (count($blah) > $excerpt_length) {

			$k = $excerpt_length;

			$use_dotdotdot = 1;

		} else {

			$k = count($blah);

			$use_dotdotdot = 0;

		}

		$excerpt = '';

		for ($i=0; $i<$k; $i++) {

			$excerpt .= $blah[$i] . ' ';

		}


		if (($use_more_link && $use_dotdotdot) || $force_more_link) {

			$excerpt .= "...&nbsp;<a href=\"". get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";

		} else {

			$excerpt .= ($use_dotdotdot) ? '...' : '';

		}

		 $output = $excerpt;

	} // end if no excerpt

	return $output;

}

////////////////////////////////////////////////////////////////////////////////
// WP-PageNavi
////////////////////////////////////////////////////////////////////////////////

function custom_wp_pagenavi($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
	global $request, $posts_per_page, $wpdb, $paged;
	if(empty($prelabel)) {
		$prelabel  = '<strong>&laquo;</strong>';
	}
	if(empty($nxtlabel)) {
		$nxtlabel = '<strong>&raquo;</strong>';
	}
	$half_pages_to_show = round($pages_to_show/2);
	if (!is_single()) {
		if(!is_category()) {
			preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches);
		} else {
			preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
		}
		$fromwhere = $matches[1];
		$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
		$max_page = ceil($numposts /$posts_per_page);
		if(empty($paged)) {
			$paged = 1;
		}
		if($max_page > 1 || $always_show) {
			echo "$before <div class=\"wp-pagenavi\"><span class=\"pages\">Page $paged of $max_page:</span>";
			if ($paged >= ($pages_to_show-1)) {
				echo '<a href="'.get_pagenum_link().'">&laquo; First</a>&nbsp;';
			}
			previous_posts_link($prelabel);
			for($i = $paged - $half_pages_to_show; $i  <= $paged + $half_pages_to_show; $i++) {
				if ($i >= 1 && $i <= $max_page) {
					if($i == $paged) {
						echo "<strong class='current'>$i</strong>";
					} else {
						echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> ';
					}
				}
			}
			next_posts_link($nxtlabel, $max_page);
			if (($paged+$half_pages_to_show) < ($max_page)) {
				echo '&nbsp;<a href="'.get_pagenum_link($max_page).'">Last &raquo;</a>';
			}
			echo "</div> $after";
		}
	}
}


////////////////////////////////////////////////////////////////////////////////
// Get Recent Comments With Avatar
////////////////////////////////////////////////////////////////////////////////
function get_avatar_recent_comment() {

global $wpdb;

$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved,
comment_type,comment_author_url,
SUBSTRING(comment_content,1,50) AS com_excerpt
FROM $wpdb->comments
LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
$wpdb->posts.ID)
WHERE comment_approved = '1' AND comment_type = '' AND
post_password = ''
ORDER BY comment_date_gmt DESC LIMIT 5";

$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
$gravatar_status = 'on'; /* off if not using */

foreach ($comments as $comment) {
$email = $comment->comment_author_email;
$grav_name = $comment->comment_author;
$grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5($email). "&amp;size=32"; ?>
<li>
<?php if($gravatar_status == 'on') { ?><img src="<?php echo $grav_url; ?>" alt="<?php echo $grav_name; ?>" /><?php } ?>
<div class="com-info">
<span class="comy"><span><?php echo strip_tags($comment->comment_author); ?></span>&nbsp;Says:</span>
<span class="comtext"><a href="<?php echo get_permalink($comment->ID); ?>#comment-<?php echo $comment->comment_ID; ?>" title="on <?php echo $comment->post_title; ?>">
<?php echo strip_tags($comment->com_excerpt); ?>...</a></span>
</div>
<div class="clearfix"></div>
</li>
<?php
}
}

////////////////////////////////////////////////////////////////////////////////

// Most Comments

////////////////////////////////////////////////////////////////////////////////

function get_hottopics($limit = 5) {

    global $wpdb, $post;

    $mostcommenteds = $wpdb->get_results("SELECT  $wpdb->posts.ID, post_title, post_name, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_total' FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date_gmt < '".gmdate("Y-m-d H:i:s")."' AND post_status = 'publish' AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER  BY comment_total DESC LIMIT $limit");

    foreach ($mostcommenteds as $post) {

			$post_title = htmlspecialchars(stripslashes($post->post_title));

			$comment_total = (int) $post->comment_total;

			echo "<li><a href=\"".get_permalink()."\">$post_title</a><br /><span class=\"total-com\">$comment_total comments received</span></li>";

    }

}

////////////////////////////////////////////////////////////////////////////////
// wp 2.7 wp_list_comment filter
////////////////////////////////////////////////////////////////////////////////

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;
}

////////////////////////////////////////////////////////////////////////////////
// Comment And Ping Setup
////////////////////////////////////////////////////////////////////////////////

function list_pings($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?>
<?php }

if(function_exists('wp_list_comments')) {

add_filter('get_comments_number', 'comment_count', 0);

function comment_count( $count ) {
	global $id;
	$comments_by_type = &separate_comments(get_comments('post_id=' . $id));
	return count($comments_by_type['comment']);
}
}

////////////////////////////////////////////////////////////////////////////////
// Comment and pingback separate controls
////////////////////////////////////////////////////////////////////////////////

$bm_trackbacks = array();
$bm_comments = array();

function split_comments( $source ) {

if ( $source ) foreach ( $source as $comment ) {

global $bm_trackbacks;
global $bm_comments;

if ( $comment->comment_type == 'trackback' || $comment->comment_type == 'pingback' ) {
$bm_trackbacks[] = $comment;
} else {
$bm_comments[] = $comment;
}
}
}

//////////////////////////////////////////////////////////
///Custom Header
//////////////////////////////////////////////////////////

define('HEADER_TEXTCOLOR', '');
define('HEADER_IMAGE', '%s/images/default.jpg'); // %s is theme dir uri
define('HEADER_IMAGE_WIDTH', 942); //width
define('HEADER_IMAGE_HEIGHT',220);
define( 'NO_HEADER_TEXT', true );


function curvie_admin_header_style() { ?>
<style type="text/css">
#headimg { background: url(<?php header_image() ?>) no-repeat; }
#headimg { height: <?php echo HEADER_IMAGE_HEIGHT; ?>px; width: 100%; }
#headimg h1, #headimg #desc { display: none; }
</style>
<?php }

if (function_exists('add_custom_image_header')) {
add_custom_image_header('', 'curvie_admin_header_style');
}

////////////////////////////////////////////////////////////////////////////////
// Sidebar Widget
////////////////////////////////////////////////////////////////////////////////

if ( function_exists('register_sidebar') ) {
	
	register_sidebar(array('name'=>'Sidebar Left',
	'before_widget' => '<li id="%1$s" class="widget %2$s">',
	'after_widget' => '</li>',
	'before_title' => '<h2>',
	'after_title' => '</h2>',
	));

	register_sidebar(array('name'=>'Sidebar Right',
	'before_widget' => '<li id="%1$s" class="widget %2$s">',
	'after_widget' => '</li>',
	'before_title' => '<h2>',
	'after_title' => '</h2>',
	));

}

////////////////////////////////////////////////////////////////////////////////
// Custom Recent Comments With Gravatar Widget
////////////////////////////////////////////////////////////////////////////////

function widget_mytheme_myrecentcoms() { ?>
<div class="widget_recentcomments_gravatar">
<h2><?php _e('Recent Comments'); ?></h2>
<ul>
<?php if(function_exists("get_avatar_recent_comment")) : ?>

<?php get_avatar_recent_comment(); ?>

<?php else : ?>

<?php mw_recent_comments(10, false, 55, 35, 35, 'all', '<li><a href="%permalink%" title="%title%">%author_name%</a>&nbsp;in&nbsp;%title%</li>','d.m.y, H:i'); ?>

<?php endif; ?>
</ul>
<div class="clearfix"></div>
</div>

<?php }

if ( function_exists('register_sidebar_widget') )

    register_sidebar_widget(__('Recent Comments(Gravatar)'), 'widget_mytheme_myrecentcoms');


////////////////////////////////////////////////////////////////////////////////
// Custom Hot Topics Widget
////////////////////////////////////////////////////////////////////////////////

function widget_mytheme_myhottopic() { ?>

<?php if(function_exists("get_hottopics")) : ?>
<li class="widget_hottopics">
<h2><?php _e('Hot Topics'); ?></h2>
	<ul>
		<?php get_hottopics(); ?>
	</ul>
</li>
<?php endif; ?>

<?php }

if ( function_exists('register_sidebar_widget') )

    register_sidebar_widget(__('Hot Topics'), 'widget_mytheme_myhottopic');
	

////////////////////////////////////////////////////////////////////////////////
// Custom Sidebar Banner Widget
////////////////////////////////////////////////////////////////////////////////

function widget_mytheme_sidebar_banner() { ?>

<?php $sidebar_banner_activate = get_option('curvie_sidebar_banner_activate'); if(($sidebar_banner_activate == '') || ($sidebar_banner_activate == 'disable')) { ?>
<?php } else { ?>
<?php $sidebar_banner_code = get_option('curvie_sidebar_banner_code'); if($sidebar_banner_code == '') { ?>
<?php } else { ?>
<div class="widget_sidebar_banner">
<h2>Text Advertisement</h2>
<div id="sidebar-banner">
<?php echo stripcslashes($sidebar_banner_code); ?>
</div>
</div>
<?php } ?>
<?php } ?>

<?php }

if ( function_exists('register_sidebar_widget') )

    register_sidebar_widget(__('Sidebar Banner'), 'widget_mytheme_sidebar_banner');
	
////////////////////////////////////////////////////////////////////////////////
// Custom Meta Widget
////////////////////////////////////////////////////////////////////////////////

function widget_cmeta($args) {
		extract($args);
		$options = get_option('widget_cmeta');
		$title = empty($options['title']) ? 'Meta' : $options['title'];
		$show = array(
			'regstr'	=> $options['show_regstr'],
			'loginout'	=> $options['show_loginout'],
			'regrss'	=> $options['show_regrss'],
			'commrss'	=> $options['show_commrss'],
			'wplink'	=> $options['show_wplink']);
?>
		<?php echo $before_widget; ?>
			<?php echo $before_title . $title . $after_title; ?>
			<ul>
			<?php if ($show['regstr']) { wp_register(); } ?>
			<?php if ($show['loginout']) { ?><li><?php wp_loginout(); ?></li><?php } ?>
			<?php if ($show['regrss']) { ?><li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo attribute_escape(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li><?php } ?>
			<?php if ($show['commrss']) { ?><li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo attribute_escape(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li><?php } ?>
			<?php if ($show['wplink']) { ?><li><a href="http://wordpress.org/" title="<?php echo attribute_escape(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li><?php } ?>
			<?php wp_meta(); ?>
			</ul>
		<?php echo $after_widget; ?>
<?php }

if ( function_exists('register_sidebar_widget') )

    wp_register_sidebar_widget('widget_cmeta',__('Custom Meta'),'widget_cmeta',array('description' => __('Log in/out, admin, feed and WordPress links, configurable')));

function widget_cmeta_control() {
		$options = get_option('widget_cmeta');
		if ( isset($_POST["cmeta-submit"]) ) {
			$newoptions['title'] = strip_tags(stripslashes($_POST["cmeta-title"]));
			$newoptions['show_regstr'] = $_POST["cmeta-sregstr"];
			$newoptions['show_loginout'] = $_POST["cmeta-sloginout"];
			$newoptions['show_regrss'] = $_POST["cmeta-sregrss"];
			$newoptions['show_commrss'] = $_POST["cmeta-scommrss"];
			$newoptions['show_wplink'] = $_POST["cmeta-swplink"];
			$options = $newoptions;
			update_option('widget_cmeta', $options);
		}
		if ( $options != $newoptions ) {
		}
		$title = attribute_escape($options['title']);
		$show = array(
			'regstr'	=> $options['show_regstr'],
			'loginout'	=> $options['show_loginout'],
			'regrss'	=> $options['show_regrss'],
			'commrss'	=> $options['show_commrss'],
			'wplink'	=> $options['show_wplink']);
	?>
				<p><label for="cmeta-title"><?php _e('Title:'); ?> <input class="widefat" id="cmeta-title" name="cmeta-title" type="text" value="<?php echo $title; ?>" /></label></p>
				<p><label for="cmeta-sregstr"><input id="cmeta-sregstr" name="cmeta-sregstr" type="checkbox" value="1"<?php if ($show['regstr']) { echo " checked=\"checked\""; } ?> /> Show "Register/Site Admin"</label></p>
				<p><label for="cmeta-sloginout"><input id="cmeta-sloginout" name="cmeta-sloginout" type="checkbox" value="1"<?php if ($show['loginout']) { echo " checked=\"checked\""; } ?> /> Show "Log in/Log out"</label></p>
				<p><label for="cmeta-sregrss"><input id="cmeta-sregrss" name="cmeta-sregrss" type="checkbox" value="1"<?php if ($show['regrss']) { echo " checked=\"checked\""; } ?> /> Show "Entries RSS"</label></p>
				<p><label for="cmeta-scommrss"><input id="cmeta-scommrss" name="cmeta-scommrss" type="checkbox" value="1"<?php if ($show['commrss']) { echo " checked=\"checked\""; } ?> /> Show "Comments RSS"</label></p>
				<p><label for="cmeta-swplink"><input id="cmeta-swplink" name="cmeta-swplink" type="checkbox" value="1"<?php if ($show['wplink']) { echo " checked=\"checked\""; } ?> /> Show "WordPress.org"</label></p>
				<input type="hidden" id="cmeta-submit" name="cmeta-submit" value="1" />
	<?php
	}
register_widget_control('widget_cmeta', 'widget_cmeta_control');


////////////////////////////////////////////////////////////////////////////////
// Theme Option
////////////////////////////////////////////////////////////////////////////////

$themename = "Curvie";
$shortname = "curvie";
$wp_dropdown_rd_admin = $wpdb->get_results("SELECT $wpdb->term_taxonomy.term_id,name,description,count FROM $wpdb->term_taxonomy LEFT JOIN $wpdb->terms ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id WHERE parent = 0 AND taxonomy = 'category' AND count != '0' GROUP BY $wpdb->terms.name ORDER by $wpdb->terms.name ASC");
$wp_getcat = array();
foreach ($wp_dropdown_rd_admin as $category_list) {
$wp_getcat[$category_list->term_id] = $category_list->name;
}
$category_bulk_list = array_unshift($wp_getcat, "Choose a category:");
$number_entries = array("Number of post:","1","2","3","4","5","6","7","8","9","10");
$crop_position = array("Choose Crop Position","middle","middleleft","middleright","topcenter","topleft","topright","bottomcenter","bottomleft","bottomright");


$options = array (


    array(	"name" => "Blog Header Settings",
            "type" => "heading",
            ),

			array(	"name" => "Use Custom Logo On The Blog Header?<br /><em>*Disable by default, Choose Yes to enable it.</em>",
			"id" => $shortname."_header_logo_activate",
            "type" => "select",
            "std" => "No",
			"options" => array("No", "Yes")),

			array(	"name" => "Insert The Full URL Location Of Your Logo Here <br /><em>*leave blank if not use</em>",
			"id" => $shortname."_logo_url",
            "type" => "text",
            "box" => "social",
            "std" => "",
            ),

			array(	"name" => "</div></div>",
            "type" => "close",
            ),


    array(	"name" => "Header Navigation Settings",
            "type" => "heading",
            ),

			array(	"name" => "Insert Page ID To Display On Header<br />
			<em>i.e ../wp-admin/page.php?action=edit&post=<span class=\"redbold\">123</span></em><br />
			<em>*separate by comma</em><br />
			<em>*Don't put too much or the layout will break</em>",
			"id" => $shortname."_header_navigation",
            "type" => "text",
            "std" => "",
            ),

			array(	"name" => "</div></div>",
            "type" => "close",
            ),


    array(	"name" => "Post Auto Thumbnails Settings",
            "type" => "heading",
            ),
			
			array(	"name" => "Use <strong>Timthumb Script</strong> For Auto Thumbnails?<br /><em>*Disable by default, Choose Yes to enable it.</em>",
			"id" => $shortname."_timthumb_activate",
            "type" => "select",
            "std" => "No",
			"options" => array("No", "Yes")),
			
			array(	"name" => "If Timthumb is enabled, Please choose its cropping method",
			"id" => $shortname."_timthumb_cropping",
            "type" => "select",
            "std" => "",
			"options" => $crop_position),

			array(	"name" => "Insert Width Of Thumbnail Image<br />
			<em>i.e. <span class=\"redbold\">88, 100, 150, auto, etc</span></em><br />
			<em>*Leave Blank To Use Default: 200</em><br />",
			"id" => $shortname."_thumb_width",
            "type" => "text",
            "std" => "",
            ),

			array(	"name" => "Insert Height Of Thumbnail Image<br />
			<em>i.e. <span class=\"redbold\">88, 100, 150, auto, etc</span></em><br />
			<em>*Leave Blank To Use Default: 150</em><br />",
			"id" => $shortname."_thumb_height",
            "type" => "text",
            "std" => "",
            ),

			array(	"name" => "</div></div>",
            "type" => "close",
            ),



    array(	"name" => "Featured Content Slider Settings",
            "type" => "heading",
            ),

			array(	"name" => "Enable <strong>Featured Content Slider</strong> On Homepage?<br /><em>*Disable by default, Choose Yes to enable it.</em>",
			"id" => $shortname."_featured_slider_activate",
            "type" => "select",
            "std" => "No",
			"options" => array("No", "Yes")),


			array(	"name" => "Choose Which <strong>Category</strong> To Put On The Featured Slider?",
			"id" => $shortname."_featured_category",
            "type" => "select",
            "std" => "Choose a category:",
			"options" => $wp_getcat),

			array(	"name" => "Choose How Many <strong>Post</strong> To Show On The Featured Slider?",
			"id" => $shortname."_featured_number",
            "type" => "select",
            "std" => "Number of post:",
			"options" => $number_entries),

			array(	"name" => "</div></div>",
            "type" => "close",
            ),



    array(	"name" => "Sidebar Banner Settings",
            "type" => "heading",
            ),

    		array(	"name" => "Enable Banner Advertisement On Sidebar<br /><em>*default are disable, you can activate it by choosing enable</em>",
			"id" => $shortname."_sidebar_banner_activate",
            "type" => "select",
            "std" => "disable",
			"options" => array("disable", "enable")),

			array(	"name" => "Insert Your Sidebar Banner Code Here<br />
			<em>*Copy &amp; Paste Your Sponsor Banner Code Or Affiliate Banner Code Here</em>",
			"id" => $shortname."_sidebar_banner_code",
            "type" => "textarea",
            "std" => "",
            ),

     		array(	"name" => "</div></div>",
            "type" => "close",
            ),

);

function curvie_admin_panel(){ if ((function_exists("check_theme_footer") || function_exists("check_theme_header"))) {

echo "<div id=\"admin-options\"> ";

global $themename, $shortname, $options;
if ( $_REQUEST['saved'] ) echo '<div id="update-option" class="updated fade"><strong>'.$themename.' settings saved.</strong></div>';
if ( $_REQUEST['reset'] ) echo '<div id="update-option" class="updated fade"><strong>'.$themename.' settings reset.</strong></div>';
?>

<h4><?php echo "$themename"; ?> Theme Options</h4>

<form action="" method="post">

<?php foreach ($options as $value) { ?>

<?php switch ( $value['type'] ) { case 'heading': ?>

<div class="get-option">

<h2><?php echo $value['name']; ?></h2>

<div class="option-save">

<?php
break;
case 'text':
?>

<div class="description"><?php echo $value['name']; ?></div>
<p><input name="<?php echo $value['id']; ?>" class="myfield" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if (

get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" /></p>

<?php
break;
case 'select':
?>

<div class="description"><?php echo $value['name']; ?></div>
<p><select name="<?php echo $value['id']; ?>" class="myselect" id="<?php echo $value['id']; ?>">
<?php foreach ($value['options'] as $option) { ?>
<option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
<?php } ?>
</select>
</p>

<?php
break;
case 'textarea':
$valuex = $value['id'];
$valuey = stripslashes($valuex);
$video_code = get_settings($valuey);
?>

<div class="description"><?php echo $value['name']; ?></div>
<p><textarea name="<?php echo $valuey; ?>" class="mytext" cols="40%" rows="8" /><?php if ( get_settings($valuey) != "") { echo stripslashes($video_code); }

else { echo $value['std']; } ?></textarea></p>

<?php
break;
case 'close':
?>

<div class="clearfix"></div>
</div><!-- OPTION SAVE END -->

<div class="clearfix"></div>
</div><!-- GET OPTION END -->

<?php
break;
default;
?>


<?php
break; } ?>

<?php } ?>

<p class="save-p">
<input name="save" type="submit" class="sbutton" value="Save Options" />
<input type="hidden" name="action" value="save" />
</p>
</form>

<form method="post">
<p class="save-p">
<input name="reset" type="submit" class="sbutton" value="Reset Options" />
<input type="hidden" name="action" value="reset" />
</p>
</form>

</div><!-- ADMIN OPTIONS END -->

<?php } else { echo ("Well, You Done It..You Just Modified Some Codes!"); } }

function curvie_admin_register() {
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", "Theme Options", 'edit_themes', basename(__FILE__), 'curvie_admin_panel');
}



?>

Poslednja izmena od imenik : 19. 03. 2010. u 20:23.
imenik je offline   Odgovorite uz citat