Advertisement
adsleeblythe

featured image header image functions.php

Oct 26th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.31 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5.     $functions_path = TEMPLATEPATH . '/functions/';
  6.  
  7.     $includes_path = TEMPLATEPATH . '/includes/';
  8.  
  9.    
  10.  
  11.     //Loading jQuery and Scripts
  12.  
  13.     require_once $includes_path . 'theme-scripts.php';
  14.  
  15.    
  16.  
  17.     //Widget and Sidebar
  18.  
  19.     require_once $includes_path . 'sidebar-init.php';
  20.  
  21.     require_once $includes_path . 'register-widgets.php';
  22.  
  23.    
  24.  
  25.     //Theme initialization
  26.  
  27.     require_once $includes_path . 'theme-init.php';
  28.  
  29.    
  30.  
  31.     //Additional function
  32.  
  33.     require_once $includes_path . 'theme-function.php';
  34.  
  35.    
  36.  
  37.     //Shortcodes
  38.  
  39.     require_once $includes_path . 'theme_shortcodes/shortcodes.php';
  40.  
  41.     include_once(TEMPLATEPATH . '/includes/theme_shortcodes/alert.php');
  42.  
  43.     include_once(TEMPLATEPATH . '/includes/theme_shortcodes/tabs.php');
  44.  
  45.     include_once(TEMPLATEPATH . '/includes/theme_shortcodes/toggle.php');
  46.  
  47.     include_once(TEMPLATEPATH . '/includes/theme_shortcodes/html.php');
  48.  
  49.    
  50.  
  51.     //tinyMCE includes
  52.  
  53.     include_once(TEMPLATEPATH . '/includes/theme_shortcodes/tinymce/tinymce_shortcodes.php');
  54.  
  55.    
  56.  
  57.    
  58.  
  59.     /*// Add support for Featured Images
  60.  
  61.     add_theme_support( 'post-thumbnails' );
  62.  
  63.     set_post_thumbnail_size( 50, 50 );*/
  64.  
  65.    
  66.  
  67.     // removes detailed login error information for security
  68.  
  69.     add_filter('login_errors',create_function('$a', "return null;"));
  70.  
  71.    
  72.  
  73.     if ( !function_exists( 'optionsframework_init' ) ) {
  74.  
  75.    
  76.  
  77.    
  78.  
  79.     /*-----------------------------------------------------------------------------------*/
  80.  
  81.     /* Options Framework Theme
  82.  
  83.     /*-----------------------------------------------------------------------------------*/
  84.  
  85.    
  86.  
  87.     /* Set the file path based on whether the Options Framework Theme is a parent theme or child theme */
  88.  
  89.    
  90.  
  91.     if ( STYLESHEETPATH == TEMPLATEPATH ) {
  92.  
  93.         define('OPTIONS_FRAMEWORK_URL', TEMPLATEPATH . '/admin/');
  94.  
  95.         define('OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('template_directory') . '/admin/');
  96.  
  97.     } else {
  98.  
  99.         define('OPTIONS_FRAMEWORK_URL', STYLESHEETPATH . '/admin/');
  100.  
  101.         define('OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('stylesheet_directory') . '/admin/');
  102.  
  103.     }
  104.  
  105.    
  106.  
  107.     require_once (OPTIONS_FRAMEWORK_URL . 'options-framework.php');
  108.  
  109.    
  110.  
  111.     }
  112.  
  113.        
  114.  
  115.     // Removes Trackbacks from the comment cout
  116.  
  117.     add_filter('get_comments_number', 'comment_count', 0);
  118.  
  119.     function comment_count( $count ) {
  120.  
  121.         if ( ! is_admin() ) {
  122.  
  123.             global $id;
  124.  
  125.             $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));
  126.  
  127.             return count($comments_by_type['comment']);
  128.  
  129.         } else {
  130.  
  131.             return $count;
  132.  
  133.         }
  134.  
  135.     }
  136.  
  137.  
  138.  
  139.    
  140.  
  141.     // enable shortcodes in sidebar
  142.  
  143.     add_filter('widget_text', 'do_shortcode');
  144.  
  145.    
  146.  
  147.     // custom excerpt ellipses for 2.9+
  148.  
  149.     function custom_excerpt_more($more) {
  150.  
  151.         return 'Read More &raquo;';
  152.  
  153.     }
  154.  
  155.     add_filter('excerpt_more', 'custom_excerpt_more');
  156.  
  157.     // no more jumping for read more link
  158.  
  159.     function no_more_jumping($post) {
  160.  
  161.         return '&nbsp;<a href="'.get_permalink($post->ID).'" class="read-more">'.'Continue Reading'.'</a>';
  162.  
  163.     }
  164.  
  165.     add_filter('excerpt_more', 'no_more_jumping');
  166.  
  167.    
  168.  
  169.    
  170.  
  171.     // category id in body and post class
  172.  
  173.     function category_id_class($classes) {
  174.  
  175.         global $post;
  176.  
  177.         foreach((get_the_category($post->ID)) as $category)
  178.  
  179.             $classes [] = 'cat-' . $category->cat_ID . '-id';
  180.  
  181.             return $classes;
  182.  
  183.     }
  184.  
  185.    
  186.  
  187.     add_filter('post_class', 'category_id_class');
  188.  
  189.     add_filter('body_class', 'category_id_class');
  190.  
  191.    
  192.  
  193.     function em_location_by_region(){
  194.  
  195.  $args = array();
  196.  
  197.  $arr_location = EM_Locations::get($args);
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  /*Get regions as header*/
  204.  
  205.  $arr_region = array();
  206.  
  207.  foreach ( $arr_location as $EM_Location_region ) {
  208.  
  209.   if ( !in_array($EM_Location_region->region,$arr_region) && !empty($EM_Location_region->region) ){
  210.  
  211.    array_push($arr_region,$EM_Location_region->region);
  212.  
  213.   }
  214.  
  215.  }
  216.  
  217.  
  218.  
  219.  /*Get state*/
  220.  
  221.  $arr_state = array();
  222.  
  223.  $arr_region_state = array();
  224.  
  225.  foreach ( $arr_region as $key => $value ) {
  226.  
  227.   foreach ( $arr_location as $EM_Location_state ) {
  228.  
  229.    if ( $EM_Location_state->region == $value ){
  230.  
  231.      array_push($arr_state,'<a href="'.$EM_Location_state->get_permalink().'">'.$EM_Location_state->name.'</a>');
  232.  
  233.    }
  234.  
  235.   }
  236.  
  237.   $arr_region_state[$value] = $arr_state;
  238.  
  239.   if ( !empty($arr_state) )$arr_state = array();
  240.  
  241.  }
  242.  
  243.  
  244.  
  245.  /*display the result*/
  246.  
  247.  foreach ( $arr_region_state as $key => $value ) {
  248.  
  249.   echo '<h4>'.$key.'</h4>';
  250.  
  251.   echo '<ul>';
  252.  
  253.   foreach ( $value as $em_state ) {
  254.  
  255.     echo '<li>'.$em_state.'</li>';
  256.  
  257.   }
  258.  
  259.   echo '</ul>';
  260.  
  261.  }
  262.  
  263.  
  264.  
  265. }
  266.  
  267. add_shortcode('location_group', 'em_location_by_region');
  268.  
  269. remove_filter( 'the_content', 'wpautop' );
  270.  
  271.  
  272.  
  273. function em_location_event_count($replace, $EM_Location, $result){
  274.  
  275.   global $wp_query, $wp_rewrite;
  276.  
  277.   switch( $result ){
  278.  
  279.     case '#_LOCATIONEVENTCOUNT':
  280.  
  281.      $replace = "0";
  282.  
  283. $events = EM_Events::get(array('location'=>$EM_Location->location_id,'scope'=>'future'));
  284.  
  285. if ( count($events) > 0 ){
  286.  
  287.  $replace = count($events);
  288.  
  289. }
  290.  
  291. $replace = "Currently ".$replace." courses in this location";
  292.  
  293.      break;
  294.  
  295.   }
  296.  
  297.   return $replace;
  298.  
  299. }
  300.  
  301. add_filter('em_location_output_placeholder','em_location_event_count',1,3);
  302.  
  303. add_theme_support( 'post-thumbnails' );
  304. set_post_thumbnail_size( 150, 150 ); // 150 pixels wide by 150 pixels tall, box resize option
  305. add_image_size( 'post-thumbnails-header', 940, 203,true ); // Header thumbnail size
  306.  
  307. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement