Advertisement
Guest User

Untitled

a guest
Mar 5th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 7.01 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Initiate Theme Options
  5. *
  6. * @uses wp_deregister_script()
  7. * @uses wp_register_script()
  8. * @uses wp_enqueue_script()
  9. * @uses register_nav_menus()
  10. * @uses add_theme_support()
  11. * @uses is_admin()
  12. *
  13. * @access public
  14. * @since 1.0.0
  15. *
  16. * @return void
  17.  
  18. * Ok, Now that's out of the way, let's rock and roll!
  19.  
  20. */
  21.  
  22.  
  23. /* Define our theme URL constant */
  24. if(!defined('WP_THEME_URL')) {
  25.     define( 'WP_THEME_URL', get_bloginfo('stylesheet_directory'));
  26. }
  27.  
  28.  
  29. /* OPTION TREE */
  30. add_filter( 'ot_show_pages', '__return_false' );  
  31. add_filter( 'ot_theme_mode', '__return_true' );
  32. include_once( 'option-tree/ot-loader.php' );
  33. include_once( 'functions/theme-options.php' );
  34.  
  35. function ot_custom_style(){
  36.    wp_register_style( 'custom_wp_admin_css', get_stylesheet_directory_uri() . '/functions/custom-option-tree/option-tree-custom.css', false, '1.0.0' );
  37.         wp_enqueue_style( 'custom_wp_admin_css' );
  38.     }
  39. add_action('admin_head', 'ot_custom_style');
  40.  
  41.  
  42. /* Load Theme Specific Widgets, Shortcodes, the ability to pull custom fields on the frontend, and our custom meta-boxes for the theme */
  43. include('functions/widgets/search_widget.php');
  44. include('functions/widgets/social_widget.php');
  45. include('functions/shortcodes.php');
  46. include('functions/custom-field.php');
  47. include_once 'functions/meta-box/meta-box-3.2.2.class.php';
  48. include 'functions/meta-box/meta-box-usage.php';
  49.  
  50.  
  51. /* Activate Our Theme Widgets */
  52. add_action('widgets_init', create_function('', 'return register_widget("SearchWidget");'));
  53. add_action('widgets_init', create_function('', 'return register_widget("SocialWidget");'));
  54.  
  55.  
  56. /** IMAGE RESIZE */
  57. include_once( 'functions/image_resize.php' );
  58.  
  59.  
  60. /* Our Master Function: Does 2 Main things
  61. *  If inside the admin panel, load up our custom style
  62. *  If outside the admin panel, register/enqueue our theme scripts, nav areas, and widget areas.
  63. */
  64. function init_mdnw() {
  65.  
  66.     /* Register all scripts, Nav Areas, and Widget Areas */
  67.     if(!is_admin()){
  68.    
  69.         /* Register all scripts */
  70.         wp_deregister_script( 'jquery' );
  71.         wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js');
  72.         wp_enqueue_script( 'jquery' );
  73.        
  74.         wp_register_script( 'jQueryEasing', WP_THEME_URL . '/assets/js/jquery.easing.js');
  75.         wp_enqueue_script( 'jQueryEasing' );   
  76.                
  77.         //wp_register_script( 'Tipsy', WP_THEME_URL . '/assets/js/jquery.tipsy.js');
  78.         //wp_enqueue_script( 'Tipsy' );
  79.        
  80.         wp_register_script( 'prettyPhoto', WP_THEME_URL . '/assets/js/jquery.prettyPhoto.js');
  81.         wp_enqueue_script( 'prettyPhoto' );
  82.                
  83.         wp_register_script( 'Cufon', WP_THEME_URL . '/assets/js/cufon.js');
  84.         wp_enqueue_script( 'Cufon' );
  85.        
  86.         wp_register_script( 'HoverIntent', WP_THEME_URL . '/assets/js/jquery.hoverIntent.js');
  87.         wp_enqueue_script( 'HoverIntent' );
  88.                
  89.         wp_register_script( 'Dropdown', WP_THEME_URL . '/assets/js/superfish.js');
  90.         wp_enqueue_script( 'Dropdown' );
  91.                        
  92.         wp_register_script( 'ScreenSpire', WP_THEME_URL . '/assets/js/artboard.js');
  93.         wp_enqueue_script( 'ScreenSpire' );
  94.  
  95.     wp_register_script( 'textualizer', get_template_directory_uri() . '/assets/js/textualizer.js',  
  96.        array('jquery'), false, true);
  97.     wp_enqueue_script( 'textualizer');
  98.    
  99.        
  100.    }
  101.    
  102.    /* Register Navigation */
  103.    register_nav_menus( array(
  104.         'topbar' => __( 'Top Bar Menu', 'Top Bar Menu' ),
  105.         'footer' => __( 'Footer Menu', 'Footer Menu' ),
  106.     ) );
  107.    
  108.     /* Register Primary Sidebar - USE WITH RAIL
  109.     register_sidebar( array(
  110.         'name' => __( 'Primary Widget Area' ),
  111.         'id' => 'primary-widget-area',
  112.         'description' => __( 'The primary widget area'),
  113.         'before_widget' => '<li id="%1$s" class="widget %2$s">',
  114.         'after_widget' => '</li>',
  115.         'before_title' => '<h2 class="widget-title">',
  116.         'after_title' => '</h2>',
  117.             ) );   */
  118.    
  119.     /* Register Secondary Sidebar (Right side, next to posts/pages) */
  120.     register_sidebar( array(
  121.         'name' => __( 'Default Post/Page Sidebar' ),
  122.         'id' => 'default-widget-area',
  123.         'description' => __( 'Default widget area for posts/pages. ' ),
  124.         'before_widget' => '<li id="%1$s" class="widget %2$s">',
  125.         'after_widget' => '</li>',
  126.         'before_title' => '<h2 class="widget-title">',
  127.         'after_title' => '</h2>',
  128.     ) );
  129.    
  130.     /* Register Footer Widgets */
  131.     register_sidebar( array(
  132.         'name' => __( 'Footer Column 1' ),
  133.         'id' => 'footer-widget-1',
  134.         'description' => __( 'The first column in the footer widget area.' ),
  135.         'before_widget' => '<li id="%1$s" class="widget %2$s">',
  136.         'after_widget' => '</li>',
  137.         'before_title' => '<h2 class="widget-title">',
  138.         'after_title' => '</h2>',
  139.     ) );   
  140.    
  141.     /* Register Footer Widgets */
  142.     register_sidebar( array(
  143.         'name' => __( 'Footer Column 2' ),
  144.         'id' => 'footer-widget-2',
  145.         'description' => __( 'The second column in the footer widget area.' ),
  146.         'before_widget' => '<li id="%1$s" class="widget %2$s">',
  147.         'after_widget' => '</li>',
  148.         'before_title' => '<h2 class="widget-title">',
  149.         'after_title' => '</h2>',
  150.     ) );
  151.    
  152.     /* Register Footer Widgets */
  153.     register_sidebar( array(
  154.         'name' => __( 'Footer Column 3' ),
  155.         'id' => 'footer-widget-3',
  156.         'description' => __( 'The third column in the footer widget area.' ),
  157.         'before_widget' => '<li id="%1$s" class="widget %2$s">',
  158.         'after_widget' => '</li>',
  159.         'before_title' => '<h2 class="widget-title">',
  160.         'after_title' => '</h2>',
  161.     ) );
  162.    
  163.     /* Register Footer Widgets */
  164.     register_sidebar( array(
  165.         'name' => __( 'Footer Column 4' ),
  166.         'id' => 'footer-widget-4',
  167.         'description' => __( 'The fourth column in the footer widget area.' ),
  168.         'before_widget' => '<li id="%1$s" class="widget %2$s">',
  169.         'after_widget' => '</li>',
  170.         'before_title' => '<h2 class="widget-title">',
  171.         'after_title' => '</h2>',
  172.     ) );
  173.    
  174.    
  175.        
  176. }    
  177. add_action('init', 'init_mdnw'); /* Run the above function at the init() hook */
  178.    
  179.  
  180.    
  181. /* Add the Chosen script to the footer (for better <select> elements). */
  182. add_action('wp_print_scripts', 'chosen'); /* Run the above function at the wp_footer() hook */ 
  183. function chosen() {
  184.     wp_enqueue_script( 'chosen', WP_THEME_URL . '/assets/js/chosen/chosen.jquery.js', array('jquery'), '0.9', true );          
  185. }        
  186.  
  187. /* ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- */
  188.  
  189. /* Required WP Theme Support */
  190. add_theme_support( 'automatic-feed-links' );
  191. add_theme_support('editor_style');
  192. add_editor_style('/assets/css/custom-editor.css');
  193.  
  194. /* Add "Post Thumbnails" Support */
  195. add_theme_support( 'post-thumbnails' );
  196. set_post_thumbnail_size( 200, 200, true );
  197.  
  198. /* Add comment-reply support */
  199. function theme_queue_js(){
  200.   if (!is_admin()){
  201.     if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1))
  202.       wp_enqueue_script( 'comment-reply' );
  203.   }
  204. }
  205. add_action('wp_print_scripts', 'theme_queue_js');
  206.  
  207. /* Disable Page Comments */
  208. function noPgComments($open,$post_id) {
  209.   if (get_post_type($post_id) == 'page') {
  210.     $open = false;
  211.   }
  212.   return $open;
  213. }
  214. add_filter( 'comments_open', 'noPgComments', 10, 2 );
  215.  
  216.  
  217.  
  218.  
  219. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement