PHP Code:
?><?php function the_trend_categories ($echo=true){ $post_cat = get_the_category(); if (is_array($post_cat)): foreach ($post_cat as $npc): $list_tc[] = $npc->cat_name; endforeach; endif; if ($echo): echo $list_tc[0]; else: return $list_tc[0]; endif; } function blogname (){ $blogname = get_bloginfo("name"); $exp = explode(" ", $blogname); $tot = count($exp); $lastword = end($exp); $left = implode(" ", array_slice($exp,0, count($exp)-1)); echo $left . " <span>" . $lastword . "</span>"; } function remove_more_link($content) { $match = preg_match('/<a href="(.+)" class="more-link">(.+)/i', $content, $matches); if ($match) { $ret_data = str_replace($matches[0], '</p>', $content); return $ret_data; } return $content; } function the_tab_image ($w=82, $h=57, $def = "No Image Found", $key='image'){ global $post; $image = get_post_meta($post->ID, $key, true); $g = blogdir . "thumb.php?src=" . $image . "&h=$h&w=$w&zc=1&q=100&nmT=" . $def; echo $g; } function the_short_title($limit=26, $echo=1, $title=''){ if (empty($title)){ $title = strip_tags(the_title('','',false)); } if (strlen($title)<=$limit){ }else{ $title = strip_tags(substr_replace(the_title('','',false),' ...',$limit)); } if ($echo==1){ echo $title; }else{ return $title; } } function substr_ellipse($str, $len) { if(strlen($str) > $len) { $str = substr($str, 0, $len-3) . "..."; } return $str; } function the_new_excerpt($limit=100){ echo substr_ellipse(get_the_excerpt(), $limit); } function most_popular_posts() { global $wpdb; $request = "SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments"; $request .= " WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish'"; $request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC"; $posts = $wpdb->get_results($request); if ($posts) { foreach ($posts as $post) { $new_posts[] = $post->ID; } } else { $new_posts[] = "0"; } return $new_posts; } function recent_commented_posts( $limt=8 ) { global $wpdb; $request = "SELECT comment_ID, comment_post_ID FROM $wpdb->comments"; $request .= " WHERE comment_approved = '1' GROUP BY comment_post_ID"; $request .= " ORDER BY comment_ID DESC"; $request .= " LIMIT $limt"; $posts = $wpdb->get_results($request); if ($posts) { foreach ($posts as $post) { $new_posts[] = $post->comment_post_ID; } } else { $new_posts[] = "0"; } return $new_posts; } function wp_list_pages_tweak ($actions = 'title_li=&echo=0'){ $pages = wp_list_pages ($actions); $pages_array = preg_split('/\n/', $pages); $count = count($pages_array); $i = 0; while ( $i < $count ) { $eo .= preg_replace('/<li (.+)>(.+)/i', '<li $1>', $category_array[$i]) . "\n"; $i++; } echo '<!--Pages Tweak-->' . $eo . '<!--/Pages Tweak-->'; } function the_list_categories_tweak ($categories){ $category_array = preg_split('/\n/', $categories); $count = count($category_array); $i = 0; while ( $i < $count ) { if ( preg_match('/<ul class=(\'|")children(\'|")/i', $category_array[$i+1]) ) { $eo .= preg_replace('/<li class=(\'|")(.+)(\'|")>/i', '<li class=$1has-child $2$3>', $category_array[$i]) . "\n"; } else { $eo .= $category_array[$i] . "\n"; } $i++; } return '<!--Categories Tweak-->' . $eo . '<!--/Categories Tweak-->'; } add_action ('wp_list_categories', 'the_list_categories_tweak'); add_action ('wp_footer', 'wp_footer_tweak'); function wp_footer_tweak (){ ?>
<div class="copyright">
<div class="wrapper">
© Copyright 2005 - <?php echo date("Y");?> <a title="<?php echo blogname;?>" href="<?php echo home;?>"><?php echo blogname;?></a> - All rights reserved -
Designed by <a href="http://www.elegantwpthemes.com/" target="_blank" title="Free WP Themes">Free WP Themes</a>, made free by <a href="http://webgazette.co.uk/cars/" target="_blank" title="Cars">Cars</a> and <a href="http://www.searchengine.ltd.uk/" target="_blank" title="SEO">SEO</a></div>
</div>
<script type="text/javascript">
var blogurl = "<?php echo home;?>";
var blogimg = "<?php echo blogimages;?>";
var is_home = <?php echo is_home()?"1":"0";?>;
</script>
<script type="text/javascript" src="<?php echo blogdir;?>js/functions.js"></script>
<script type="text/javascript" src="<?php echo blogdir;?>js/BakerSignetBT.js"></script>
<script type="text/javascript" src="<?php echo blogdir;?>js/BankGothic.js"></script>
<script type="text/javascript" src="<?php echo blogdir;?>js/corners.js"></script>
<script type="text/javascript" src="<?php echo blogdir;?>js/autos.js"></script>
<script type="text/javascript" src="<?php echo blogdir;?>js/ddmenu.js"></script>
<?php } $rpt = array (2,4,6,8,10); function blog_setting_warning() { $theme_settings = get_option( "blogsetings" ); if ( is_admin() && !is_array($theme_settings) ) { echo " <div id='theme-warning' class='updated fade'><p><strong>".__('Theme is not configured yet.')."</strong> ".sprintf(__('You must <a href="%1$s">configure this theme</a> for it to work.'), "themes.php?page=blog-options")."</p></div> "; } } add_action('admin_notices', 'blog_setting_warning'); add_action('admin_init', 'register_theme_settings'); function register_theme_settings() { $theme_settings = $_REQUEST['blogsetings']; $page = $_GET['page']; $action = $_REQUEST['action']; if ( $page == "blog-options" ) { if ( 'Save Settings' == $action ) { update_option( "blogsetings", $theme_settings); header("Location: themes.php?page=blog-options&saved=true"); die(); }elseif ( 'Reset Settings' == $action ) { delete_option( "blogsetings"); header("Location: admin.php?page=blog-options&reset=true"); die(); } } } function theme_options_css_js() { ?>
<style type="text/css">
.metabox-holder {
width: 350px; float: left;
margin: 0px; padding: 0px 10px 0px 0px;
}
.metabox-holder .postbox .inside {
padding: 0px 10px 0px 10px;
}
.catOptions { width:100%; height:184px!important; }
.catOption { width:100%; height:132px!important; }
</style>
<script type="text/javascript">
jQuery(document).ready(function($) {
$("#blog-options").submit(function() {
if ( $("#blog-options .catOption option:selected").length > 3 ){
alert('Only three categories to be set as featured.');
return false;
}
return true;
});
});
</script>
<?php } ?><?
Bookmarks