__( 'Header Menu', 'giga_games' ), ) ); } add_action( 'init', 'mp_register_my_menus' ); // Show posts of 'game' and 'post' post type add_action( 'pre_get_posts', 'mp_add_my_post_types_to_query' ); function mp_add_my_post_types_to_query( $query ) { if ( is_home() && $query->is_main_query() ) { $query->set( 'post_type', array( 'giga_game', 'post' ) ); //Add post type giga_game to main query for game plugin support /* Get all sticky posts */ $sticky = get_option( 'sticky_posts' ); $numberstickies = mp_sticky_counter(); //get number of stickies (max 4) $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; if( $paged != 1 ) { $numberstickies = 0; } /* Sort the stickies with the newest ones at the top */ rsort( $sticky ); /* Get the 4 newest stickies (change 2 for a different number) */ $sticky = array_slice( $sticky, 4 ); /* Query sticky posts */ $query->set( 'post__not_in' , $sticky ); $query->set( 'posts_per_page', get_option('posts_per_page') - $numberstickies ); } return $query; } /** * Sticky counter function * */ function mp_sticky_counter() { $sticky = get_option( 'sticky_posts' ); $numberstickies = count( $sticky ); if( $numberstickies > 4 ) { $numberstickies = 4; } return $numberstickies; } //thumbail resize if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 480, 320, true ); } //add image size if ( function_exists( 'add_image_size' ) ) { add_image_size( 'prev-2', 200, 125, true ); } //add link to post thumbnail add_filter( 'post_thumbnail_html', 'mp_post_image_html', 10, 3 ); function mp_post_image_html( $html, $post_id, $post_image_id ) { $html = '' . $html . ''; return $html; } /** * Register our sidebars and widgetized areas. * */ function mp_register_sidebars() { register_sidebar( array( //sidebar on home page 'name' => 'Home Sidebar', 'id' => 'home_right_1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( //sidebar next to single game 'name' => 'Single Game', 'id' => 'single_game_1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( //sidebar next to pages and posts 'name' => 'General Sidebar', 'id' => 'general_1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( //footer1 'name' => 'Footer 1', 'id' => 'footer_1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( //footer2 'name' => 'Footer 2', 'id' => 'footer_2', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( //footer3 'name' => 'Footer 3', 'id' => 'footer_3', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( //footer4 'name' => 'Footer 4', 'id' => 'footer_4', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'mp_register_sidebars' ); function mp_numeric_posts_nav() { if( is_singular() ) return; global $wp_query; /** Stop execution if there's only 1 page */ if( $wp_query->max_num_pages <= 1 ) return; $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1; //$max = intval( $wp_query->max_num_pages ); $max = intval(($wp_query->found_posts + mp_sticky_counter()) / get_option('posts_per_page ')); /** Add current page to the array */ if ( $paged >= 1 ) $links[] = $paged; /** Add the pages around the current page to the array */ if ( $paged >= 3 ) { $links[] = $paged - 1; $links[] = $paged - 2; } if ( ( $paged + 2 ) <= $max ) { $links[] = $paged + 2; $links[] = $paged + 1; } echo '' . "\n"; } /** * Code for displaying post meta * */ add_action('mp_post_meta', 'mp_display_post_meta'); function mp_display_post_meta() { the_tags('
');?>
post_content != "" ) { the_excerpt(); } } function mp_excerpt_more( $more ) { return ' ' . get_theme_mod('readmore_text', '...Read more') . ''; } add_filter( 'excerpt_more', 'mp_excerpt_more' ); add_filter('excerpt_length', 'mp_excerpt_length', 999); function mp_excerpt_length( $length ) { return get_theme_mod( 'post_excerpt_length', '30' ); } add_filter( 'excerpt_length', 'mp_excerpt_length', 999 ); /** * Special thumbnail function * */ function mp_thumbnail( $width, $height ) { global $post; if ( '' == has_post_thumbnail() && get_theme_mod( 'show_placeholder', '1' ) ) { // check if the post has a Post Thumbnail assigned to it. ?>