Created
May 21, 2013 13:03
-
-
Save sta1r/5619605 to your computer and use it in GitHub Desktop.
Pro method to set up Wordpress styles and scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Enqueue scripts and styles | |
| */ | |
| function the_general_scripts() { | |
| wp_enqueue_style( 'style', get_stylesheet_uri() ); | |
| if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { | |
| wp_enqueue_script( 'comment-reply' ); | |
| } | |
| if ( is_singular() && wp_attachment_is_image() ) { | |
| wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); | |
| } | |
| wp_register_script( 'flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'),null,true ); | |
| wp_register_script( 'fancybox', get_template_directory_uri() . '/js/fancybox/jquery.fancybox.pack.js', array('jquery'),null,true ); | |
| wp_register_script( 'view', get_template_directory_uri() . '/js/view.min.js', array('jquery'),null,true ); | |
| wp_register_script( 'fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', array('jquery'),null,true ); | |
| wp_register_script( 'sharing', get_template_directory_uri() . '/js/sharing.js', array('jquery'),null,true ); | |
| if (!is_admin()) { | |
| wp_enqueue_script('fitvids'); | |
| wp_enqueue_script('sharing'); | |
| if ('portfolio' == get_post_type()) { | |
| //wp_enqueue_script('flexslider'); | |
| wp_enqueue_script('view'); | |
| } | |
| } | |
| } | |
| add_action( 'wp_enqueue_scripts', 'the_general_scripts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment