<?php
require_once('class-tgm-plugin-activation.php');
include ( 'getplugins.php' );
include ( 'cpt.php' );
include ( 'guide.php' );
include ( 'metabox.php' );
add_theme_support( 'automatic-feed-links' );
add_custom_background();
/* SIDEBARS */
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Sidebar',
'before_widget' => '<li class="sidebox %2$s">',
'after_widget' => '</li>',
'before_title' => '<h3 class="sidetitl">',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => 'Footer',
'before_widget' => '<li class="botwid %2$s">',
'after_widget' => '</li>',
'before_title' => '<h3 class="bothead">',
'after_title' => '</h3>',
));
/* CUSTOM MENUS */
register_nav_menus( array(
'primary' => __( 'Primary Navigation', '' ),
) );
function fallbackmenu(){ ?>
<div id="submenu">
<ul><li> Go to Adminpanel > Appearance > Menus to create your menu. You should have WP 3.0+ version for custom menus to work.</li></ul>
</div>
<?php }
/* FEATURED THUMBNAILS */
if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
add_theme_support( 'post-thumbnails' );
add_image_size( 'game_feature', 1000, 500, true );
add_image_size( 'story_feature', 150, 100, true );
add_image_size( 'video_feature', 150, 200, true );
add_image_size( 'review_thumb', 120, 80, true );
add_image_size( 'post_image', 660, 350, true );
}
/* CUSTOM EXCERPTS */
function wpe_excerptlength_aside($length) {
return 15;
}
function wpe_excerptlength_side($length) {
return 15;
}
function wpe_excerptlength_archive($length) {
return 60;
}
function wpe_excerptlength_index($length) {
return 25;
}
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 = '<p>'.$output.'</p>';
echo $output;
}
add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
if(is_category() || is_tag()) {
$post_type = get_query_var('post_type');
if($post_type)
$post_type = $post_type;
else
$post_type = array('post','review','news','featured');
$query->set('post_type',$post_type);
return $query;
}
}
/* PAGE NAVIGATION */
function getpagenavi(){
?>
<div id="navigation" class="clearfix">
<?php if(function_exists('wp_pagenavi')) : ?>
<?php wp_pagenavi() ?>
<?php else : ?>
<div class="alignleft"><?php next_posts_link(__('« Older Entries','web2feeel')) ?></div>
<div class="alignright"><?php previous_posts_link(__('Newer Entries »','web2feel')) ?></div>
<div class="clear"></div>
<?php endif; ?>
</div>
<?php
}
//FLUSH REWRITE RULES
function custom_flush_rewrite_rules() {
global $pagenow, $wp_rewrite;
if ( 'themes.php' == $pagenow && isset( $_GET['activated'] ) )
$wp_rewrite->flush_rules();
}
add_action( 'load-themes.php', 'custom_flush_rewrite_rules' );