Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Buttercream enqueue styles functions

By: a guest on May 24th, 2012  |  syntax: PHP  |  size: 2.40 KB  |  views: 40  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /**
  2.  * Enqueue scripts and styles
  3.  */
  4. function buttercream_scripts() {
  5.         global $post;
  6.  
  7.         $options = get_option('buttercream_theme_options');
  8.  
  9.         $buttercream_themestyle = $options['theme_style'];
  10.         $buttercream_customcss = $options['custom_css'];
  11.  
  12.         wp_register_style( 'googlefonts', 'http://fonts.googleapis.com/css?family=Norican|Alegreya:400italic,700italic,400,700|Stint+Ultra+Condensed' );
  13.         wp_enqueue_style( 'googlefonts' );
  14.  
  15.         if ( isset( $options['responsive'] ) && $options['responsive'] == "on" ) {
  16.                 wp_register_style( 'mediacss', get_template_directory_uri() . '/layouts/media.css', 'media-css' );
  17.                 wp_enqueue_style( 'mediacss');
  18.         }
  19.         else {
  20.                 wp_register_style( 'mediaie', get_template_directory_uri() . '/layouts/ie.css', 'media-css' );
  21.                 wp_enqueue_style( 'mediaie');
  22.         }
  23.  
  24.         wp_enqueue_style( 'style', get_stylesheet_uri() );
  25.  
  26.         wp_enqueue_script( 'jquery' );
  27.  
  28.         wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true );
  29.  
  30.         if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  31.                 wp_enqueue_script( 'comment-reply' );
  32.         }
  33.  
  34.         if ( is_singular() && wp_attachment_is_image( $post->ID ) ) {
  35.                 wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
  36.         }
  37.  
  38.         if ( file_exists( get_template_directory() . '/css/yellow.css' ) && 'yellow' == $buttercream_themestyle ) {
  39.                 wp_register_style( 'buttercream_yellow', get_template_directory_uri() . '/css/yellow.css' );
  40.                 wp_enqueue_style( 'buttercream_yellow' );
  41.         } else if ( file_exists( get_template_directory() . '/css/red.css' ) && 'red' == $buttercream_themestyle ) {
  42.                 wp_register_style( 'buttercream_red', get_template_directory_uri() . '/css/red.css' );
  43.                 wp_enqueue_style( 'buttercream_red' );
  44.         } else {
  45.                 wp_register_style( 'buttercream_cupcake', get_template_directory_uri() . '/css/cupcake.css' );
  46.                 wp_enqueue_style( 'buttercream_cupcake' );
  47.         }
  48.  
  49.         if ( $buttercream_customcss ) {
  50.                 echo "<style type='text/css'>";
  51.                 echo $buttercream_customcss;
  52.                 echo "</style>";
  53.         }
  54.  
  55. }
  56. add_action( 'wp_enqueue_scripts', 'buttercream_scripts' );
  57.  
  58. function buttercream_head() { ?>
  59.  
  60.         <!--[if lt IE 9]>
  61.         <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
  62.         <![endif]-->
  63.  
  64. <?php
  65. }
  66.  
  67. add_action( 'wp_head', 'buttercream_head', 1 );