Hot answers tagged

2

I you want the script be enqueued on page-index.php and page-contact-us.php, then you must check that that page templates are used but you are checking if they are not used. Chagne this: if ( !is_page_template('page-templates/page-index.php') && !is_page_template('page-templates/page-contact-us.php') ) { with: if ( ...


2

WP loads jQuery in no conflict mode so shortcut $ is not available for jQuery to use .You should not use the $ variable for jQuery within WordPress. jQuery(function ($) { //code here }) or (function($){ //code here })(jQuery); There are so many Q&A which refers to the same conflict issue.Check this and this.


2

The priority is related to other actions for the same hook. For example, if another plugin would implement add_action for wp_enqueue_scripts with a lower priority, they would have their scripts loaded in front of yours. You should check what scripts are inserted above yours and see if there is a css conflict.


1

There is no good way of doing this. One way is to enumerate the already registered scripts, like this: function yourplugin_add_my_stylesheet() { global $wp_styles; if ( $wp_styles instanceof WP_Styles ) { // enumerate all current styles foreach( $wp_styles->queue as $handle ) { // use the $handle to see if ...



Only top voted, non community-wiki answers of a minimum length are eligible