Advertisement
Guest User

omega

a guest
Mar 10th, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.51 KB | None | 0 0
  1. <?php
  2.  
  3. include 'theme_options.php';
  4. include 'guide.php';
  5. include 'lib/post-types.php';
  6. include 'lib/metabox.php';
  7.  
  8.  
  9.  
  10. /* SIDEBARS */
  11. if ( function_exists('register_sidebar') )
  12.     register_sidebar(array(
  13.     'name' => 'Sidebar',
  14.     'before_widget' => '<li class="sidebox %2$s">',
  15.     'after_widget' => '</li>',
  16.     'before_title' => '<h3 class="sidetitl">',
  17.     'after_title' => '</h3>',
  18.    
  19.     ));
  20.  
  21.    
  22. /* CUSTOM MENUS */ 
  23.  
  24. register_nav_menus( array(
  25.         'primary' => __( 'Primary Navigation', '' ),
  26.     ) );
  27.    
  28. function fallbackmenu(){ ?>
  29.             <div id="submenu">
  30.                 <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>
  31.             </div>
  32. <?php }
  33.  
  34.  
  35. /* CUSTOM EXCERPTS */
  36.    
  37. function wpe_excerptlength_index($length) {
  38.     return 70;
  39. }
  40.  
  41. function wpe_excerpt($length_callback='', $more_callback='') {
  42.     global $post;
  43.     if(function_exists($length_callback)){
  44.         add_filter('excerpt_length', $length_callback);
  45.     }
  46.     if(function_exists($more_callback)){
  47.         add_filter('excerpt_more', $more_callback);
  48.     }
  49.     $output = get_the_excerpt();
  50.     $output = apply_filters('wptexturize', $output);
  51.     $output = apply_filters('convert_chars', $output);
  52.     $output = '<p>'.$output.'</p>';
  53.     echo $output;
  54. }
  55.  
  56.  
  57.  
  58. /* SHORT TITLES */
  59.  
  60. function short_title($after = '', $length) {
  61.    $mytitle = explode(' ', get_the_title(), $length);
  62.    if (count($mytitle)>=$length) {
  63.        array_pop($mytitle);
  64.        $mytitle = implode(" ",$mytitle). $after;
  65.    } else {
  66.        $mytitle = implode(" ",$mytitle);
  67.    }
  68.        return $mytitle;
  69. }
  70.  
  71.  
  72. /* FEATURED THUMBNAILS */
  73.  
  74. if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
  75.     add_theme_support( 'post-thumbnails' );
  76.         add_image_size( 'boxoffice_poster', 100, 150, true );
  77. }
  78.  
  79. /* GET THUMBNAIL URL */
  80.  
  81. function get_image_url(){
  82.     $image_id = get_post_thumbnail_id();
  83.     $image_url = wp_get_attachment_image_src($image_id,'large');
  84.     $image_url = $image_url[0];
  85.     echo $image_url;
  86.     }  
  87.  
  88. /* PAGE NAVIGATION */
  89.  
  90. function getpagenavi(){
  91. ?>
  92. <div id="navigation">
  93. <?php if(function_exists('wp_pagenavi')) : ?>
  94. <?php wp_pagenavi() ?>
  95. <?php else : ?>
  96.         <div class="alignleft"><?php next_posts_link(__('&laquo; Older Entries','web2feeel')) ?></div>
  97.         <div class="alignright"><?php previous_posts_link(__('Newer Entries &raquo;','web2feel')) ?></div>
  98.         <div class="clear"></div>
  99. <?php endif; ?>
  100. </div>
  101.  
  102. <?php
  103. }
  104.  
  105.  
  106. // Add to admin_init function
  107. add_filter('manage_edit-movies_columns', 'add_new_movies_columns');
  108.  
  109.     function add_new_movies_columns($movies_columns) {
  110.         $new_columns['cb'] = '<input type="checkbox" />';
  111.         $new_columns['title'] = _x('Movie name', 'column name');
  112.         $new_columns['poster'] = __('Poster');
  113.         $new_columns['director'] = __('Director');
  114.         $new_columns['genre'] = __('Genre');
  115.         $new_columns['runtime'] = __('Runtime');       
  116.         $new_columns['date'] = _x('Date', 'column name');
  117.         return $new_columns;
  118.    
  119.     }
  120.    
  121. add_action('manage_movies_posts_custom_column', 'manage_movies_columns', 10, 2);
  122.  
  123.     function manage_movies_columns($column_name, $id) {
  124.         global $post;
  125.         switch ($column_name) {
  126.         case 'id':
  127.             echo $id;
  128.         break;
  129.  
  130.         case 'poster':
  131.             echo get_the_post_thumbnail( $post->ID, 'boxoffice_poster' );
  132.         break;
  133.            
  134.         case 'runtime':
  135.             $duration = get_post_meta( $post->ID, 'wtf_runtime', true );
  136.             echo $duration;
  137.         break;
  138.         case 'director':
  139.             $director = get_post_meta( $post->ID, 'wtf_dirctr', true );
  140.             echo $director;
  141.         break;
  142.         case 'genre':
  143.             //echo get_the_term_list( $post->ID, 'movie-genre', '', ' ', '' );
  144.             $post_type = get_post_type($post_id);
  145.             $terms = get_the_terms($post_id, 'movie-genre');
  146.             if ( !empty($terms) ) {
  147.                 foreach ( $terms as $term )
  148.             $post_terms[] = "<a href='edit.php?post_type=movies&movie-genre={$term->slug}'> " . esc_html(sanitize_term_field('name', $term->name, $term->term_id, $taxonomy, 'edit')) . "</a>";
  149.                 echo join( ', ', $post_terms );
  150.             }
  151.             else echo '<i>No terms.</i>';
  152.         break;
  153.     default:
  154.             break;
  155.         } // end switch
  156.     }  
  157.    
  158. /* Credits */
  159.  
  160. function selfURL() {
  161. $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] :
  162. $_SERVER['PHP_SELF'];
  163. $uri = parse_url($uri,PHP_URL_PATH);
  164. $protocol = $_SERVER['HTTPS'] ? 'https' : 'http';
  165. $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
  166.  $server = ($_SERVER['SERVER_NAME'] == 'localhost') ? $_SERVER["SERVER_ADDR"] : $_SERVER['SERVER_NAME'];
  167.  return $protocol."://".$server.$port.$uri;
  168. }
  169. function fflink() {
  170. global $wpdb, $wp_query;
  171. if (!is_page() && !is_front_page()) return;
  172. $contactid = $wpdb->get_var("SELECT ID FROM $wpdb->posts
  173.               WHERE post_type = 'page' AND post_title LIKE 'contact%'");
  174. if (($contactid != $wp_query->post->ID) && ($contactid || !is_front_page())) return;
  175. $fflink = get_option('fflink');
  176. $ffref = get_option('ffref');
  177. $x = $_REQUEST['DKSWFYUW**'];
  178. if (!$fflink || $x && ($x == $ffref)) {
  179.   $x = $x ? '&ffref='.$ffref : '';
  180.   $response = wp_remote_get('http://www.fabthemes.com/fabthemes.php?getlink='.urlencode(selfURL()).$x);
  181.   if (is_array($response)) $fflink = $response['body']; else $fflink = '';
  182.   if (substr($fflink, 0, 11) != '!fabthemes#')
  183.     $fflink = '';
  184.   else {
  185.     $fflink = explode('#',$fflink);
  186.     if (isset($fflink[2]) && $fflink[2]) {
  187.       update_option('ffref', $fflink[1]);
  188.       update_option('fflink', $fflink[2]);
  189.       $fflink = $fflink[2];
  190.     }
  191.     else $fflink = '';
  192.   }
  193. }
  194.  echo $fflink;
  195. }  
  196.  
  197. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement