Advertisement
tex2005

option-tree bug 01

Mar 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.88 KB | None | 0 0
  1. <?php
  2. /**
  3.  * OmniBiz functions and definitions
  4.  *
  5.  * @package OmniBiz
  6.  * @since OmniBiz 1.0
  7.  */
  8.  
  9. /**
  10.  * Set the content width based on the theme's design and stylesheet.
  11.  *
  12.  * @since OmniBiz 1.0
  13.  */
  14. if ( ! isset( $content_width ) )
  15.     $content_width = 940; /* pixels */
  16.  
  17. if ( ! function_exists( 'omnibiz_setup' ) ) :
  18. /**
  19.  * Sets up theme defaults and registers support for various WordPress features.
  20.  *
  21.  * Note that this function is hooked into the after_setup_theme hook, which runs
  22.  * before the init hook. The init hook is too late for some features, such as indicating
  23.  * support post thumbnails.
  24.  *
  25.  * @since OmniBiz 1.0
  26.  */
  27. function omnibiz_setup() {
  28.  
  29.  
  30.     /**
  31.      * Custom template tags for this theme.
  32.      */
  33.     //require( get_template_directory() . '/inc/template-tags.php' );
  34.  
  35.     /**
  36.      * Custom functions that act independently of the theme templates
  37.      */
  38.     //require( get_template_directory() . '/inc/extras.php' );
  39.  
  40.     /**
  41.      * Optional: set 'ot_show_pages' filter to false.
  42.      * This will hide the settings & documentation pages.
  43.      */
  44.     add_filter( 'ot_show_pages', '__return_false' );
  45.  
  46.     /**
  47.      * Required: set 'ot_theme_mode' filter to true.
  48.      */
  49.     add_filter( 'ot_theme_mode', '__return_true' );
  50.  
  51.     /**
  52.      * Optional: set 'ot_show_new_layout' filter to false.
  53.      * This will hide the "New Layout" section on the Theme Options page.
  54.      */
  55.     add_filter( 'ot_show_new_layout', '__return_false' );
  56.  
  57.     /**
  58.      * Required: include OptionTree.
  59.      */
  60.     include_once( 'option-tree/ot-loader.php' );
  61.  
  62.     /**
  63.      * Theme Options
  64.      */
  65.     include_once( 'inc/theme-options.php' );
  66.     include_once( 'inc/plugins.php' );
  67.     include_once( 'inc/metaboxes.php' );
  68.     include_once( 'inc/resize.php' );
  69.  
  70.     /**
  71.      * Include Shortcodes
  72.      */
  73.      require_once( get_template_directory() . '/inc/shortcodes.php' );
  74.      require_once( get_template_directory() . '/inc/widgets.php' );
  75.  
  76.  
  77.     /**
  78.      * Make theme available for translation
  79.      * Translations can be filed in the /languages/ directory
  80.      * If you're building a theme based on OmniBiz, use a find and replace
  81.      * to change 'omnibiz' to the name of your theme in all the template files
  82.      */
  83.     load_theme_textdomain( 'omnibiz', get_template_directory() . '/languages' );
  84.  
  85.     /**
  86.      * Add default posts and comments RSS feed links to head
  87.      */
  88.     add_theme_support( 'automatic-feed-links' );
  89.  
  90.     /**
  91.      * Enable support for Post Thumbnails
  92.      */
  93.     add_theme_support( 'post-thumbnails' );
  94.     if ( function_exists( 'add_image_size' ) ) {
  95.         add_image_size( 'blogindex-small-thumb', 200, 200, true );
  96.     }
  97.  
  98.     /**
  99.      * Enable support for Custom Background
  100.      */
  101.     add_theme_support( 'custom-background' );
  102.  
  103.     /**
  104.      * This theme uses wp_nav_menu() in one location.
  105.      */
  106.     register_nav_menus( array(
  107.         'primary' => __( 'Primary Menu', 'omnibiz' ),
  108.         'secoundry' => __( 'Secoundry Menu', 'omnibiz' ),
  109.     ) );
  110.  
  111.     /**
  112.      * Add support for the Aside Post Formats
  113.      */
  114.     //add_theme_support( 'post-formats', array( 'aside', ) );
  115. }
  116. endif; // omnibiz_setup
  117. add_action( 'after_setup_theme', 'omnibiz_setup' );
  118.  
  119.  
  120. /**
  121.  * Enqueue scripts and styles
  122.  *
  123.  * @since OmniBiz 1.0
  124.  */
  125. function omnibiz_scripts() {
  126.  
  127.     wp_register_style( 'style', get_template_directory_uri() . '/css/style.css', array(), '1.0', 'screen' );
  128.     wp_register_style( 'plugins', get_template_directory_uri() . '/css/plugins.css', array(), '1.0', 'screen' );
  129.     wp_register_style( 'color', get_template_directory_uri(). '/css/colors/'.ot_get_option('style_skin' , 'blue').'.css', array(), '1.0', 'screen');
  130.     wp_register_style( 'responsive', get_template_directory_uri() . '/css/responsive.css', array(), '1.0', 'screen' );
  131.     wp_register_style( 'skinstyle', get_stylesheet_directory_uri() . '/style.css', array(), '1.0', 'screen' );
  132.  
  133.     wp_enqueue_style( 'style' );
  134.     wp_enqueue_style( 'plugins' );
  135.     wp_enqueue_style( 'color' );
  136.     wp_enqueue_style( 'responsive' );
  137.     wp_enqueue_style('dynamic-css', admin_url('admin-ajax.php').'?action=dynamic_css', array(),'1.0','screen');
  138.     wp_enqueue_style( 'skinstyle' );
  139.  
  140.  
  141.     if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  142.         wp_enqueue_script( 'comment-reply' );
  143.     }
  144.     wp_register_script('modernizr', get_template_directory_uri(). '/js/modernizr.js');
  145.     wp_register_script('ui-custom', get_template_directory_uri(). '/js/jquery-ui.custom.min.js', array('jquery'), '', true);
  146.     wp_register_script('ui-tabs-paging', get_template_directory_uri(). '/js/ui.tabs.paging.js', array('jquery'), '', true);
  147.     wp_register_script('easing', get_template_directory_uri(). '/js/jquery.easing.js', array('jquery'), '', true);
  148.     wp_register_script('flexslider', get_template_directory_uri(). '/js/jquery.flexslider-min.js', array('jquery'), '', true);
  149.     wp_register_script('camera', get_template_directory_uri(). '/js/camera.min.js', array('jquery'), '', true);
  150.     wp_register_script('cslider', get_template_directory_uri(). '/js/jquery.cslider.js', array('jquery'), '', true);
  151.     wp_register_script('touchswipe', get_template_directory_uri(). '/js/jquery.touchSwipe.min.js', array('jquery'), '', true);
  152.     wp_register_script('caroufredsel', get_template_directory_uri(). '/js/jquery.caroufredsel.js', array('jquery'), '', true);
  153.     wp_register_script('isotope', get_template_directory_uri(). '/js/jquery.isotope.min.js', array('jquery'), '', true);
  154.     wp_register_script('tipsy', get_template_directory_uri(). '/js/jquery.tipsy.js', array('jquery'), '', true);
  155.     wp_register_script('zflickrfeed', get_template_directory_uri(). '/js/jquery.zflickrfeed.js', array('jquery'), '', true);
  156.     wp_register_script('fitvid', get_template_directory_uri(). '/js/jquery.fitvid.js', array('jquery'), '', true);
  157.     wp_register_script('fancybox', get_template_directory_uri(). '/js/jquery.fancybox.js', array('jquery'), '', true);
  158.     wp_register_script('timeago', get_template_directory_uri(). '/js/jquery.timeago.js', array('jquery'), '', true);
  159.     wp_register_script('tweetable', get_template_directory_uri(). '/js/jquery.tweetable.js', array('jquery'), '', true);
  160.     wp_register_script('hoverintent', get_template_directory_uri(). '/js/jquery.hoverIntent.js', array('jquery'), '', true);
  161.     wp_register_script('superfish', get_template_directory_uri(). '/js/jquery.superfish.js', array('jquery'), '', true);
  162.     wp_register_script('googlemap','http://maps.google.com/maps/api/js?sensor=false',array(),'',true);
  163.     wp_register_script('jqgmap', get_template_directory_uri(). '/js/jquery.gmap.min.js', array('jquery'), '', true);
  164.     wp_register_script('jqcountdown', get_template_directory_uri(). '/js/jquery.countdown.min.js', array('jquery'), '', true);
  165.     wp_register_script('jqeasypie', get_template_directory_uri(). '/js/jquery.easy-pie-chart.js', array('jquery'), '', true);
  166.  
  167.     wp_register_script('custom', get_template_directory_uri(). '/js/omnibiz-custom.js', array('jquery'), '', true);
  168.  
  169.  
  170.     wp_enqueue_script('modernizr');
  171.     wp_enqueue_script('ui-custom');
  172.     wp_enqueue_script('ui-tabs-paging');
  173.     wp_enqueue_script('easing');
  174.     wp_enqueue_script('flexslider');
  175.     wp_enqueue_script('camera');
  176.     wp_enqueue_script('cslider');
  177.     wp_enqueue_script('touchswipe');
  178.     wp_enqueue_script('caroufredsel');
  179.     wp_enqueue_script('isotope');
  180.     wp_enqueue_script('tipsy');
  181.     wp_enqueue_script('zflickrfeed');
  182.     wp_enqueue_script('fitvid');
  183.     wp_enqueue_script('fancybox');
  184.     wp_enqueue_script('timeago');
  185.     wp_enqueue_script('tweetable');
  186.     wp_enqueue_script('hoverintent');
  187.     wp_enqueue_script('superfish');
  188.     if (is_page_template('template-contact.php') || is_page_template('template-contactalt.php')){
  189.         wp_enqueue_script('googlemap');
  190.         wp_enqueue_script('jqgmap');
  191.     }
  192.     if (is_page_template('template-soon.php')){
  193.         wp_enqueue_script('jqcountdown');
  194.         wp_enqueue_script('jqeasypie');
  195.     }
  196.     wp_enqueue_script('custom');
  197.  
  198. }
  199. add_action( 'wp_enqueue_scripts', 'omnibiz_scripts' );
  200.  
  201. function xo_dynamic_css() {
  202.     require(get_template_directory().'/dynamic-stylesheet.php');
  203.     exit;
  204. }
  205. add_action('wp_ajax_dynamic_css', 'xo_dynamic_css');
  206. add_action('wp_ajax_nopriv_dynamic_css', 'xo_dynamic_css');
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213. /*
  214.  * Redirection for Maintenance Mode
  215.  */
  216.  
  217. function xo_wpse_76802_maintance_mode() {
  218.     $pages_soon = ot_get_option('pages_soon', 'disabled');
  219.     if ($pages_soon == 'enabled'){
  220.         $maintenance_page =  ot_get_option('pages_comingsoon_page');
  221.         if ( ! is_page( $maintenance_page ) ) {
  222.             wp_redirect( esc_url (get_permalink($maintenance_page)) );
  223.         }
  224.     }
  225. }
  226. add_action( 'template_redirect', 'xo_wpse_76802_maintance_mode' );
  227.  
  228.  
  229.  
  230.  
  231. //Tags Widget Custom Args
  232. add_filter( 'widget_tag_cloud_args', 'xo_tag_cloud_args' );
  233. function xo_tag_cloud_args(){
  234.     return 'smallest=14&largest=14&number=0&orderby=name&unit=px';
  235. }
  236.  
  237.  
  238.  
  239. function xo_closed_meta_boxes( $closed ) {
  240.         if ( false === $closed )
  241.                 $closed = array( 'incr_metabox_sidebar' );
  242.  
  243.         return $closed;
  244. }
  245. add_filter( 'get_user_option_closedpostboxes_{post_type_slug}', 'xo_closed_meta_boxes' );
  246.  
  247. // Enable shortcodes in text widgets
  248. add_filter('widget_text', 'do_shortcode');
  249.  
  250.  
  251.  
  252. add_action( 'after_setup_theme', 'xo_wpse3882_after_setup_theme' );
  253. function xo_wpse3882_after_setup_theme()
  254. {
  255.         add_editor_style();
  256. }
  257.  
  258. add_filter('mce_buttons_2', 'xo_wpse3882_mce_buttons_2');
  259. function xo_wpse3882_mce_buttons_2($buttons)
  260. {
  261.         array_unshift($buttons, 'styleselect');
  262.         return $buttons;
  263. }
  264.  
  265. add_filter('tiny_mce_before_init', 'xo_wpse3882_tiny_mce_before_init');
  266. function xo_wpse3882_tiny_mce_before_init($settings)
  267. {
  268.         $settings['theme_advanced_blockformats'] = 'p,h1,h2,h3,h4,h5,h6';
  269.  
  270.         // From http://tinymce.moxiecode.com/examples/example_24.php
  271.         $style_formats = array(
  272.                 array('title' => 'Lead Paragraph', 'selector' => 'p', 'classes' => 'lead')
  273.         );
  274.         // Before 3.1 you needed a special trick to send this array to the configuration.
  275.         // See this post history for previous versions.
  276.         $settings['style_formats'] = json_encode( $style_formats );
  277.  
  278.         return $settings;
  279. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement