Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed

The issue in your first block of code is syntax: if( get_post_type() == ( ‘activity’ OR ‘dining’ OR ‘heritage’ OR ‘hiking’ OR ‘nightlife’ ) ) : this isn’t proper use of OR and will evaluate true regardless of what get_post_type() returns. The issue in your second block is again syntax, you have to break; at … Read more

Deregister a CSS file that comes with a plugin

You can use wp_dequeue_style function, with a wp_enqueue_script hook with priority higher than WPML’s wp_enqueue_script hook. Put the following code into your functions.php: function dequeue_wpml_styles(){ wp_dequeue_style( ‘wmpl_style_handle’ ); } add_action( ‘wp_enqueue_scripts’, ‘dequeue_wpml_styles’, 20 ); REPLACE ‘wmpl_style_handle’ with the handle WPML registers/enqueues the style. UPDATE: I have just had a look into WPML and it looks … Read more

is there a way to get all queued scripts/styles into a template without `get_header()`?

the_header() does not even seem to be native WP function? Technically getting header isn’t what really causes styles and scripts to load, it’s wp_head() call that should be made there (and wp_footer() call in footer). So they are likely what you should be using. If you do need something lower level you might want to … Read more

Function to load correct CSS for Template not working

I think your big problem here is your use of underscores (_) in your page template names. According to the Handbook of Coding Standards Files should be named descriptively using lowercase letters. Hyphens should separate words. my-plugin-name.php Also, for best practices you should call your custom page templates page-whatever.php So for instance, index_page.php should be … Read more