SHARE
TWEET

Untitled

a guest Jun 14th, 2016 20 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function webriti_scripts()
  3. {  
  4.     $quality_pro_options=theme_data_setup();
  5.     $current_options = wp_parse_args(  get_option( 'quality_pro_options', array() ), $quality_pro_options );
  6.     $class=$current_options['style_sheet'];
  7.     wp_enqueue_style('bootstrap', WEBRITI_TEMPLATE_DIR_URI . '/css/bootstrap.css');
  8.     wp_enqueue_style('quality-style', get_stylesheet_uri() );
  9.     if($current_options['link_color_enable'] != true)
  10.     {
  11.         wp_enqueue_style('default', WEBRITI_TEMPLATE_DIR_URI . '/css/'.$class);
  12.     }
  13.     wp_enqueue_style('theme-menu', WEBRITI_TEMPLATE_DIR_URI . '/css/theme-menu.css');
  14.     wp_enqueue_style('media-responsive', WEBRITI_TEMPLATE_DIR_URI . '/css/media-responsive.css');  
  15.     wp_enqueue_style('font-awesome-min', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css');
  16.     wp_enqueue_style('layout', WEBRITI_TEMPLATE_DIR_URI . '/css/switcher/layout-responsive.css');
  17.     wp_enqueue_script('menu', WEBRITI_TEMPLATE_DIR_URI .'/js/menu/menu.js',array('jquery'));
  18.     wp_enqueue_script('bootstrap', WEBRITI_TEMPLATE_DIR_URI .'/js/bootstrap.min.js');
  19.     wp_enqueue_script('custom-js', WEBRITI_TEMPLATE_DIR_URI .'/js/custom.js');
  20.     wp_enqueue_style('lightbox', WEBRITI_TEMPLATE_DIR_URI . '/css/lightbox.css');
  21.    
  22.     //Home Page And Home Page Template js and css
  23.     if(is_home() || is_page_template('template-frontpage.php'))  {
  24.     wp_enqueue_style('flexslider', WEBRITI_TEMPLATE_DIR_URI . '/css/flexslider/flexslider.css');
  25.     wp_enqueue_script('flexslider', WEBRITI_TEMPLATE_DIR_URI .'/js/flexslider/jquery.flexslider.js');
  26.     wp_enqueue_script('carouFredSel', WEBRITI_TEMPLATE_DIR_URI .'/js/caroufredsel/jquery.carouFredSel-6.2.1-packed.js');
  27.     wp_enqueue_script('lightbox', WEBRITI_TEMPLATE_DIR_URI .'/js/lightbox/lightbox-2.6.min.js');
  28.     }
  29.    
  30.     if(is_page_template('template-frontpage-parallax.php'))
  31.     {
  32.        
  33.         wp_enqueue_style('flexslider', WEBRITI_TEMPLATE_DIR_URI . '/css/flexslider/flexslider.css');
  34.         wp_enqueue_script('flexslider', WEBRITI_TEMPLATE_DIR_URI .'/js/flexslider/jquery.flexslider.js');
  35.         wp_enqueue_script('lightbox', WEBRITI_TEMPLATE_DIR_URI .'/js/lightbox/lightbox-2.6.min.js');
  36.         wp_enqueue_style('style-animate', WEBRITI_TEMPLATE_DIR_URI . '/css/animate.css');
  37.         wp_enqueue_style('style-parallax', WEBRITI_TEMPLATE_DIR_URI . '/css/style-parallax.css');
  38.         wp_enqueue_script('caroufredsel-element', WEBRITI_TEMPLATE_DIR_URI .'/js/caroufredsel/caroufredsel-element.js');
  39.         wp_enqueue_script('carouFredSel', WEBRITI_TEMPLATE_DIR_URI .'/js/caroufredsel/jquery.carouFredSel-6.2.1-packed.js');
  40.         wp_enqueue_script('script-scroll-sticky', WEBRITI_TEMPLATE_DIR_URI .'/js/scroll/jquery.sticky.js');
  41.         wp_enqueue_script('script-scroll-parallax', WEBRITI_TEMPLATE_DIR_URI .'/js/scroll/parallax.js',array(),'0.1',true);
  42.     }
  43.     // Portfolio js and css
  44.     if(is_page_template('portfolio-2-column.php') || is_page_template('portfolio-3-column.php') || is_page_template('portfolio-4-column.php'))
  45.     {
  46.         wp_enqueue_style('lightbox', WEBRITI_TEMPLATE_DIR_URI . '/css/lightbox.css');  
  47.         wp_enqueue_script('lightbox', WEBRITI_TEMPLATE_DIR_URI .'/js/lightbox/lightbox-2.6.min.js');
  48.     }
  49.    
  50.     if(is_page_template('single-quality_portfolio.php') || 'quality_portfolio' == get_post_type())
  51.     {
  52.         wp_enqueue_style('lightbox', WEBRITI_TEMPLATE_DIR_URI . '/css/lightbox.css');  
  53.         wp_enqueue_script('lightbox', WEBRITI_TEMPLATE_DIR_URI .'/js/lightbox/lightbox-2.6.min.js');
  54.     }
  55. }
  56. add_action('wp_enqueue_scripts', 'webriti_scripts');
  57.  
  58. if ( is_singular() ){ wp_enqueue_script( "comment-reply" ); }
  59.  
  60. function webriti_custom_enqueue_css()
  61. {   global $pagenow;
  62.     if ( in_array( $pagenow, array( 'post.php', 'post-new.php', 'page-new.php', 'page.php' ) ) ) {
  63.         wp_enqueue_style('meta-box-css', WEBRITI_TEMPLATE_DIR_URI . '/css/meta-box.css');  
  64.     }  
  65. }
  66. add_action( 'admin_print_styles', 'webriti_custom_enqueue_css', 10 );
  67. function quality_shortcode_detect() {
  68.     global $wp_query;  
  69.     $posts = $wp_query->posts;
  70.     $pattern = get_shortcode_regex();
  71.     foreach ($posts as $post){
  72.         if (   preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) && array_key_exists( 2, $matches ) && in_array( 'button', $matches[2] ) || in_array( 'row', $matches[2] ) || in_array( 'accordian', $matches[2] ) || in_array( 'tabgroup', $matches[2]) || in_array( 'tabs', $matches[2] ) || in_array( 'alert', $matches[2] ) || in_array( 'dropcap', $matches[2] )  || in_array( 'gridsystemlayout', $matches[2] ) || in_array( 'tooltip', $matches[2] ) || in_array( 'heading', $matches[2] )) {
  73.             wp_enqueue_script('bootstrap', WEBRITI_TEMPLATE_DIR_URI .'/js/bootstrap.min.js',array('jquery'));
  74.             wp_enqueue_script('accordion-tab', WEBRITI_TEMPLATE_DIR_URI .'/js/accordion-tab.js');
  75.             wp_enqueue_script('collapse', WEBRITI_TEMPLATE_DIR_URI .'/js/collapse.js');
  76.            
  77.             break;
  78.         }
  79.     }
  80. }
  81. add_action( 'wp', 'quality_shortcode_detect' );
  82.  
  83. add_action( 'admin_enqueue_scripts', 'admin_enqueue_script_function' );
  84. function admin_enqueue_script_function()
  85. {
  86. wp_enqueue_style( 'jquery-ui' );
  87. wp_enqueue_style('quality-drag-drop',WEBRITI_TEMPLATE_DIR_URI.'/css/drag-drop.css');
  88. wp_enqueue_script('quality-jquery-ui' , WEBRITI_TEMPLATE_DIR_URI.'/js/jquery-ui.js');
  89. wp_enqueue_script('quality-jquery-ui-drag' , WEBRITI_TEMPLATE_DIR_URI.'/js/layout-drag-drop.js');
  90. }
  91. add_action('wp_head','head_enqueue_custom_css');
  92. function head_enqueue_custom_css()
  93. {
  94.     require_once( WEBRITI_THEME_FUNCTIONS_PATH .'/scripts/custom_style.php');
  95.     $quality_pro_options=theme_data_setup();
  96.     $current_options = wp_parse_args(  get_option( 'quality_pro_options', array() ), $quality_pro_options );
  97.     if($current_options['webrit_custom_css']!='') {  ?>
  98.     <style>
  99.     <?php echo $current_options['webrit_custom_css']; ?>
  100.     </style>
  101. <?php
  102.         }
  103. }
  104. // footer custom script
  105. function footer_custom_script()
  106. {
  107. $quality_pro_options=theme_data_setup();
  108. $current_options = wp_parse_args(  get_option( 'quality_pro_options', array() ), $quality_pro_options);
  109.     if($current_options['link_color_enable'] == true) {
  110.         custom_light();
  111.     }
  112. }
  113. add_action('wp_footer','footer_custom_script');
  114. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top