Enqueue scripts not working with if is page conditional tag in functions.php

Try doing in the opposite way. Add_action can always be active, and add the if statement into the function. Like this: add_action(‘wp_enqueue_scripts’, ‘insert_mapsvg_scripts’); function insert_mapsvg_scripts() { if( is_page( 37629 ) ) { wp_enqueue_style( ‘mapsvg_css’, site_url(‘/mapsvg/css/mapsvg.css’) ); wp_enqueue_style( ‘nanoscroller_css’, site_url(‘/mapsvg/css/nanoscroller.css’) ); wp_enqueue_script( ‘mousewheel_js’, site_url(‘/mapsvg/js/jquery.mousewheel.min.js’), array(‘jquery’), ”, true ); wp_enqueue_script( ‘nanoscroller_js’, site_url(‘/mapsvg/js/jquery.nanoscroller.min.js’), array(‘jquery’), ”, true ); wp_enqueue_script( … Read more

Check if post has gallery images/media

No Need for SQL queries in the template. function wpse_72594_get_attachments( $id, $mime=”” ) { $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ => $mime, ‘post_parent’ => $id ); $attachments = get_posts($args); if ($attachments) return $attachments; return false; } Then call the function like this (300 is the post ID): wpse_72594_get_attachments(300), grabs all attachments wpse_72594_get_attachments(300, ‘image’ ), … Read more

Excluding custom post types

This function could help you filter out non standard post types: function is_non_standard_type($id = null) { if (!$id) { // rewind_posts(); global $post; $id = $post->ID; } $post_type = get_post_type( $id ); return in_array($post_type, array(‘post’, ‘page’, ‘attachment’, ‘nav_menu, ‘nav_menu_item’, ‘revision’)); // You might want to handle revision differently } Keep in mind though that this … Read more

How to use is_feed() to target a category feed?

If you want to determine if you are in a category feed, for example: http://example.com/category/football/feed you can do so with add_action(‘wp’, ‘mycheck’); function mycheck() { if(is_feed() && is_category() ){ // do stuff } } or add_action(‘wp’, ‘mycheck’); function mycheck() { global $wp_query; if($wp_query->is_feed && $wp_query->is_category){ // do stuff } } You can similarly check if … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)