array (
'url' => '%s/images/header_alt.png',
'thumbnail_url' => '%s/images/header_alt.png',
'description' => __( 'Alternative Header', 'cover-wp' )
)
)
);
add_custom_image_header('header_style', 'twentyten_admin_header_style');
// Widgetable Areas
if ( function_exists('register_sidebar') )
{
register_sidebar(array('name' => 'Header','before_widget' => '
','after_widget' => '
','before_title' => '','after_title' => '
'));
register_sidebar(array('name' => 'Sidebar Top','before_widget' => '','after_widget' => '
','before_title' => '','after_title' => '
'));
register_sidebar(array('name' => 'Sidebar Left','before_widget' => '','after_widget' => '
','before_title' => '','after_title' => '
'));
register_sidebar(array('name' => 'Sidebar Right','before_widget' => '','after_widget' => '
','before_title' => '','after_title' => '
'));
register_sidebar(array('name' => 'Sidebar Bottom','before_widget' => '','after_widget' => '
','before_title' => '','after_title' => '
'));
register_sidebar(array('name' => 'Footer','before_widget' => '','after_widget' => '
','before_title' => '','after_title' => '
'));
function unregister_problem_widgets() {
wp_unregister_sidebar_widget('search');
}
add_action('widgets_init','unregister_problem_widgets');
}
// Page Title
function display_title($s)
{
if (is_404())
_e('Page Not Found ','cover-wp');
elseif (is_search())
{
_e('Search Results for ','cover-wp');
echo '"'.$s.'" ';
}
elseif (is_tag())
{
_e('Entries tagged with ','cover-wp');
echo '"'.single_tag_title("", false).'" ';
}
else
wp_title(' ');
if(wp_title(' ', false)) echo ' | ';
bloginfo('name');
}
// List Most Commented
function list_most_commented() {
global $wpdb;
$posts = $wpdb->get_results("SELECT comment_count,ID,post_title,post_status FROM $wpdb->posts WHERE post_status='publish' ORDER BY comment_count DESC LIMIT 0 , 6");
foreach ($posts as $post) {
$postid = $post->ID;
$title = $post->post_title;
$commentcount = $post->comment_count;
$poststatus = $post->post_status;
if (($commentcount) && ($poststatus = 'publish')) { ?>
', ']]>', $text);
$text = strip_tags($text);
$length = 150;
$excerpt_length = apply_filters('excerpt_length', $length);
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
array_push($words, '...');
$text = implode(' ', $words);
}
return $text;
}
// Post Thumbnails
if ( function_exists( 'add_theme_support' ) )
{
add_theme_support( 'post-thumbnails', array( 'post' ) );
set_post_thumbnail_size( 50, 50, true );
}
function catch_that_image()
{
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('//i', $post->post_content, $matches);
if(count($matches [1]))$first_img = $matches [1] [0];
return $first_img;
}
function display_thumbnail($width, $height, $words,$inc)
{
$values = get_post_custom_values("Image");
if(!$values) $values = get_post_custom_values("image");
$catch = catch_that_image();
if ( function_exists( 'has_post_thumbnail' ) && has_post_thumbnail() )
{
$title = get_the_title();
the_post_thumbnail(array($width,$height), array('alt' => $title));
}
elseif($values)
{ ?>
get_results("SELECT post_id,meta_value FROM $wpdb->postmeta WHERE meta_key='Image' ORDER BY post_id DESC LIMIT 0 , 10");
$im = 0;
foreach ($wpmeta as $topfive) {
$meta = $topfive->meta_value;
$metaid = $topfive->post_id;
$custom[$im] = $meta;
$customid[$im] = $metaid;
$im++;
}
$words = 17;
$backup = $words;
$thumb = $wpdb->get_results("SELECT _thumbnail_id FROM $wpdb->postmeta");
$result = $wpdb->get_results("SELECT comment_count,ID,post_date,post_title,post_content,post_status,post_type FROM $wpdb->posts WHERE post_type='post' and post_status='publish' ORDER BY comment_count DESC, 5");
$hdl = 1;
$ppl = 0;
foreach ($result as $topfive) {
$postid = $topfive->ID;
$title = $topfive->post_title;
$content = $topfive->post_content;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('//i', $content, $matches);
$first_img = $matches [1] [0];
$content = strip_tags($content);
$commentcount = $topfive->comment_count;
$excerpt = explode(' ',$content);
if($ppl < 3) { ?>
Extra profile information
';
echo ''.$comment->comment_author.'';
echo ' '.__('on','cover-wp').' '.get_the_title($comment->comment_post_ID).'
';
$content = $comment->comment_content;
$content = substr_replace($content, '', 80);
echo '"'.strip_tags ($content).'…"';
}
}
}
// Unregister WP-Page-Navi Stylesheet
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
function my_deregister_styles() {
wp_deregister_style( 'wp-pagenavi' );
}
// Remove potentially unnecessary tags from head
remove_action('wp_head', 'rsd_link');
// remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'start_post_rel_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'adjacent_posts_rel_link');
/* *** WordPress 3.0 Features *** */
// Custom Background
if ( function_exists( 'add_custom_background' ) ) add_custom_background();
// Custom Menus
function mytheme_addmenus() {
if ( function_exists( 'register_nav_menus' ) )
register_nav_menus(
array(
'main_nav' => 'Main Menu', // You can add more menus here
)
);
}
add_action( 'init', 'mytheme_addmenus' );
function mytheme_nav() {
if ( function_exists( 'wp_nav_menu' ) )
wp_nav_menu( array('menu' => 'main_nav', 'container' => '', 'menu_id' => 'menu', 'fallback_cb' => 'mytheme_nav_fallback') );
else
mytheme_nav_fallback();
}
function mytheme_nav_fallback() { ?>