Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * OmniBiz functions and definitions
- *
- * @package OmniBiz
- * @since OmniBiz 1.0
- */
- /**
- * Set the content width based on the theme's design and stylesheet.
- *
- * @since OmniBiz 1.0
- */
- if ( ! isset( $content_width ) )
- $content_width = 940; /* pixels */
- if ( ! function_exists( 'omnibiz_setup' ) ) :
- /**
- * Sets up theme defaults and registers support for various WordPress features.
- *
- * Note that this function is hooked into the after_setup_theme hook, which runs
- * before the init hook. The init hook is too late for some features, such as indicating
- * support post thumbnails.
- *
- * @since OmniBiz 1.0
- */
- function omnibiz_setup() {
- /**
- * Custom template tags for this theme.
- */
- //require( get_template_directory() . '/inc/template-tags.php' );
- /**
- * Custom functions that act independently of the theme templates
- */
- //require( get_template_directory() . '/inc/extras.php' );
- /**
- * Optional: set 'ot_show_pages' filter to false.
- * This will hide the settings & documentation pages.
- */
- add_filter( 'ot_show_pages', '__return_false' );
- /**
- * Required: set 'ot_theme_mode' filter to true.
- */
- add_filter( 'ot_theme_mode', '__return_true' );
- /**
- * Optional: set 'ot_show_new_layout' filter to false.
- * This will hide the "New Layout" section on the Theme Options page.
- */
- add_filter( 'ot_show_new_layout', '__return_false' );
- /**
- * Required: include OptionTree.
- */
- include_once( 'option-tree/ot-loader.php' );
- /**
- * Theme Options
- */
- include_once( 'inc/theme-options.php' );
- include_once( 'inc/plugins.php' );
- include_once( 'inc/metaboxes.php' );
- include_once( 'inc/resize.php' );
- /**
- * Include Shortcodes
- */
- require_once( get_template_directory() . '/inc/shortcodes.php' );
- require_once( get_template_directory() . '/inc/widgets.php' );
- /**
- * Make theme available for translation
- * Translations can be filed in the /languages/ directory
- * If you're building a theme based on OmniBiz, use a find and replace
- * to change 'omnibiz' to the name of your theme in all the template files
- */
- load_theme_textdomain( 'omnibiz', get_template_directory() . '/languages' );
- /**
- * Add default posts and comments RSS feed links to head
- */
- add_theme_support( 'automatic-feed-links' );
- /**
- * Enable support for Post Thumbnails
- */
- add_theme_support( 'post-thumbnails' );
- if ( function_exists( 'add_image_size' ) ) {
- add_image_size( 'blogindex-small-thumb', 200, 200, true );
- }
- /**
- * Enable support for Custom Background
- */
- add_theme_support( 'custom-background' );
- /**
- * This theme uses wp_nav_menu() in one location.
- */
- register_nav_menus( array(
- 'primary' => __( 'Primary Menu', 'omnibiz' ),
- 'secoundry' => __( 'Secoundry Menu', 'omnibiz' ),
- ) );
- /**
- * Add support for the Aside Post Formats
- */
- //add_theme_support( 'post-formats', array( 'aside', ) );
- }
- endif; // omnibiz_setup
- add_action( 'after_setup_theme', 'omnibiz_setup' );
- /**
- * Enqueue scripts and styles
- *
- * @since OmniBiz 1.0
- */
- function omnibiz_scripts() {
- wp_register_style( 'style', get_template_directory_uri() . '/css/style.css', array(), '1.0', 'screen' );
- wp_register_style( 'plugins', get_template_directory_uri() . '/css/plugins.css', array(), '1.0', 'screen' );
- wp_register_style( 'color', get_template_directory_uri(). '/css/colors/'.ot_get_option('style_skin' , 'blue').'.css', array(), '1.0', 'screen');
- wp_register_style( 'responsive', get_template_directory_uri() . '/css/responsive.css', array(), '1.0', 'screen' );
- wp_register_style( 'skinstyle', get_stylesheet_directory_uri() . '/style.css', array(), '1.0', 'screen' );
- wp_enqueue_style( 'style' );
- wp_enqueue_style( 'plugins' );
- wp_enqueue_style( 'color' );
- wp_enqueue_style( 'responsive' );
- wp_enqueue_style('dynamic-css', admin_url('admin-ajax.php').'?action=dynamic_css', array(),'1.0','screen');
- wp_enqueue_style( 'skinstyle' );
- if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
- wp_enqueue_script( 'comment-reply' );
- }
- wp_register_script('modernizr', get_template_directory_uri(). '/js/modernizr.js');
- wp_register_script('ui-custom', get_template_directory_uri(). '/js/jquery-ui.custom.min.js', array('jquery'), '', true);
- wp_register_script('ui-tabs-paging', get_template_directory_uri(). '/js/ui.tabs.paging.js', array('jquery'), '', true);
- wp_register_script('easing', get_template_directory_uri(). '/js/jquery.easing.js', array('jquery'), '', true);
- wp_register_script('flexslider', get_template_directory_uri(). '/js/jquery.flexslider-min.js', array('jquery'), '', true);
- wp_register_script('camera', get_template_directory_uri(). '/js/camera.min.js', array('jquery'), '', true);
- wp_register_script('cslider', get_template_directory_uri(). '/js/jquery.cslider.js', array('jquery'), '', true);
- wp_register_script('touchswipe', get_template_directory_uri(). '/js/jquery.touchSwipe.min.js', array('jquery'), '', true);
- wp_register_script('caroufredsel', get_template_directory_uri(). '/js/jquery.caroufredsel.js', array('jquery'), '', true);
- wp_register_script('isotope', get_template_directory_uri(). '/js/jquery.isotope.min.js', array('jquery'), '', true);
- wp_register_script('tipsy', get_template_directory_uri(). '/js/jquery.tipsy.js', array('jquery'), '', true);
- wp_register_script('zflickrfeed', get_template_directory_uri(). '/js/jquery.zflickrfeed.js', array('jquery'), '', true);
- wp_register_script('fitvid', get_template_directory_uri(). '/js/jquery.fitvid.js', array('jquery'), '', true);
- wp_register_script('fancybox', get_template_directory_uri(). '/js/jquery.fancybox.js', array('jquery'), '', true);
- wp_register_script('timeago', get_template_directory_uri(). '/js/jquery.timeago.js', array('jquery'), '', true);
- wp_register_script('tweetable', get_template_directory_uri(). '/js/jquery.tweetable.js', array('jquery'), '', true);
- wp_register_script('hoverintent', get_template_directory_uri(). '/js/jquery.hoverIntent.js', array('jquery'), '', true);
- wp_register_script('superfish', get_template_directory_uri(). '/js/jquery.superfish.js', array('jquery'), '', true);
- wp_register_script('googlemap','http://maps.google.com/maps/api/js?sensor=false',array(),'',true);
- wp_register_script('jqgmap', get_template_directory_uri(). '/js/jquery.gmap.min.js', array('jquery'), '', true);
- wp_register_script('jqcountdown', get_template_directory_uri(). '/js/jquery.countdown.min.js', array('jquery'), '', true);
- wp_register_script('jqeasypie', get_template_directory_uri(). '/js/jquery.easy-pie-chart.js', array('jquery'), '', true);
- wp_register_script('custom', get_template_directory_uri(). '/js/omnibiz-custom.js', array('jquery'), '', true);
- wp_enqueue_script('modernizr');
- wp_enqueue_script('ui-custom');
- wp_enqueue_script('ui-tabs-paging');
- wp_enqueue_script('easing');
- wp_enqueue_script('flexslider');
- wp_enqueue_script('camera');
- wp_enqueue_script('cslider');
- wp_enqueue_script('touchswipe');
- wp_enqueue_script('caroufredsel');
- wp_enqueue_script('isotope');
- wp_enqueue_script('tipsy');
- wp_enqueue_script('zflickrfeed');
- wp_enqueue_script('fitvid');
- wp_enqueue_script('fancybox');
- wp_enqueue_script('timeago');
- wp_enqueue_script('tweetable');
- wp_enqueue_script('hoverintent');
- wp_enqueue_script('superfish');
- if (is_page_template('template-contact.php') || is_page_template('template-contactalt.php')){
- wp_enqueue_script('googlemap');
- wp_enqueue_script('jqgmap');
- }
- if (is_page_template('template-soon.php')){
- wp_enqueue_script('jqcountdown');
- wp_enqueue_script('jqeasypie');
- }
- wp_enqueue_script('custom');
- }
- add_action( 'wp_enqueue_scripts', 'omnibiz_scripts' );
- function xo_dynamic_css() {
- require(get_template_directory().'/dynamic-stylesheet.php');
- exit;
- }
- add_action('wp_ajax_dynamic_css', 'xo_dynamic_css');
- add_action('wp_ajax_nopriv_dynamic_css', 'xo_dynamic_css');
- /*
- * Redirection for Maintenance Mode
- */
- function xo_wpse_76802_maintance_mode() {
- $pages_soon = ot_get_option('pages_soon', 'disabled');
- if ($pages_soon == 'enabled'){
- $maintenance_page = ot_get_option('pages_comingsoon_page');
- if ( ! is_page( $maintenance_page ) ) {
- wp_redirect( esc_url (get_permalink($maintenance_page)) );
- }
- }
- }
- add_action( 'template_redirect', 'xo_wpse_76802_maintance_mode' );
- //Tags Widget Custom Args
- add_filter( 'widget_tag_cloud_args', 'xo_tag_cloud_args' );
- function xo_tag_cloud_args(){
- return 'smallest=14&largest=14&number=0&orderby=name&unit=px';
- }
- function xo_closed_meta_boxes( $closed ) {
- if ( false === $closed )
- $closed = array( 'incr_metabox_sidebar' );
- return $closed;
- }
- add_filter( 'get_user_option_closedpostboxes_{post_type_slug}', 'xo_closed_meta_boxes' );
- // Enable shortcodes in text widgets
- add_filter('widget_text', 'do_shortcode');
- add_action( 'after_setup_theme', 'xo_wpse3882_after_setup_theme' );
- function xo_wpse3882_after_setup_theme()
- {
- add_editor_style();
- }
- add_filter('mce_buttons_2', 'xo_wpse3882_mce_buttons_2');
- function xo_wpse3882_mce_buttons_2($buttons)
- {
- array_unshift($buttons, 'styleselect');
- return $buttons;
- }
- add_filter('tiny_mce_before_init', 'xo_wpse3882_tiny_mce_before_init');
- function xo_wpse3882_tiny_mce_before_init($settings)
- {
- $settings['theme_advanced_blockformats'] = 'p,h1,h2,h3,h4,h5,h6';
- // From http://tinymce.moxiecode.com/examples/example_24.php
- $style_formats = array(
- array('title' => 'Lead Paragraph', 'selector' => 'p', 'classes' => 'lead')
- );
- // Before 3.1 you needed a special trick to send this array to the configuration.
- // See this post history for previous versions.
- $settings['style_formats'] = json_encode( $style_formats );
- return $settings;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement