Advertisement
Guest User

functions.php

a guest
Jul 29th, 2012
700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.29 KB | None | 0 0
  1. <?php
  2. require_once('class-tgm-plugin-activation.php');
  3. include ( 'getplugins.php' );
  4. include ( 'cpt.php' );
  5. include ( 'guide.php' );
  6. include ( 'metabox.php' );
  7.  
  8. add_theme_support( 'automatic-feed-links' );
  9.  
  10. add_custom_background();  
  11.  
  12. /* SIDEBARS */
  13. if ( function_exists('register_sidebar') )
  14.  
  15.     register_sidebar(array(
  16.     'name' => 'Sidebar',
  17.     'before_widget' => '<li class="sidebox %2$s">',
  18.     'after_widget' => '</li>',
  19.     'before_title' => '<h3 class="sidetitl">',
  20.     'after_title' => '</h3>',
  21.    
  22.     ));
  23.  
  24.     register_sidebar(array(
  25.     'name' => 'Footer',
  26.     'before_widget' => '<li class="botwid %2$s">',
  27.     'after_widget' => '</li>',
  28.     'before_title' => '<h3 class="bothead">',
  29.     'after_title' => '</h3>',
  30.     ));    
  31.  
  32.  
  33.  
  34. /* CUSTOM MENUS */ 
  35.  
  36. register_nav_menus( array(
  37.         'primary' => __( 'Primary Navigation', '' ),
  38.     ) );
  39.  
  40. function fallbackmenu(){ ?>
  41.             <div id="submenu">
  42.                 <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>
  43.             </div>
  44. <?php }
  45.  
  46.  
  47.  
  48.  
  49.  
  50. /* FEATURED THUMBNAILS */
  51.  
  52. if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
  53.     add_theme_support( 'post-thumbnails' );
  54.     add_image_size( 'game_feature', 1000, 500, true );
  55.     add_image_size( 'story_feature', 150, 100, true );
  56.     add_image_size( 'video_feature', 150, 200, true );
  57.     add_image_size( 'review_thumb', 120, 80, true );
  58.     add_image_size( 'post_image', 660, 350, true );
  59. }
  60.  
  61. /* CUSTOM EXCERPTS */
  62.    
  63. function wpe_excerptlength_aside($length) {
  64.     return 15;
  65. }
  66.    
  67. function wpe_excerptlength_side($length) {
  68.     return 15;
  69. }
  70.    
  71. function wpe_excerptlength_archive($length) {
  72.     return 60;
  73. }
  74. function wpe_excerptlength_index($length) {
  75.     return 25;
  76. }
  77.  
  78.  
  79. function wpe_excerpt($length_callback='', $more_callback='') {
  80.     global $post;
  81.     if(function_exists($length_callback)){
  82.         add_filter('excerpt_length', $length_callback);
  83.     }
  84.     if(function_exists($more_callback)){
  85.         add_filter('excerpt_more', $more_callback);
  86.     }
  87.     $output = get_the_excerpt();
  88.     $output = apply_filters('wptexturize', $output);
  89.     $output = apply_filters('convert_chars', $output);
  90.     $output = '<p>'.$output.'</p>';
  91.     echo $output;
  92. }
  93. add_filter('pre_get_posts', 'query_post_type');
  94. function query_post_type($query) {
  95.   if(is_category() || is_tag()) {
  96.     $post_type = get_query_var('post_type');
  97.     if($post_type)
  98.         $post_type = $post_type;
  99.     else
  100.         $post_type = array('post','review','news','featured');
  101.     $query->set('post_type',$post_type);
  102.     return $query;
  103.     }
  104. }
  105.  
  106. /* PAGE NAVIGATION */
  107.  
  108. function getpagenavi(){
  109.     ?>
  110.     <div id="navigation" class="clearfix">
  111.     <?php if(function_exists('wp_pagenavi')) : ?>
  112.     <?php wp_pagenavi() ?>
  113.     <?php else : ?>
  114.             <div class="alignleft"><?php next_posts_link(__('&laquo; Older Entries','web2feeel')) ?></div>
  115.             <div class="alignright"><?php previous_posts_link(__('Newer Entries &raquo;','web2feel')) ?></div>
  116.             <div class="clear"></div>
  117.     <?php endif; ?>
  118.  
  119.     </div>
  120.  
  121.     <?php
  122.     }
  123.  
  124. //FLUSH REWRITE RULES
  125.  
  126.     function custom_flush_rewrite_rules() {
  127.         global $pagenow, $wp_rewrite;
  128.         if ( 'themes.php' == $pagenow && isset( $_GET['activated'] ) )
  129.             $wp_rewrite->flush_rules();
  130.     }
  131.  
  132.     add_action( 'load-themes.php', 'custom_flush_rewrite_rules' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement