is_page_template & is_page in functions.php not working

Use wp_enqueue_scripts instead on init. This will ensure you the template is already loaded. add_action(‘wp_enqueue_scripts’, ‘maps_scripts’); Or you try to check the template using get_page_template_slug() instead of is_page_template: $tmp = get_page_template_slug($post_id); // provide page/post ID if(‘page-about.php’ == $tmp) { // enqueue scripts here } Note that you don’t need to register scripts before enqueueing them. … Read more

How to localize value of posts

Try: function register_and_enqueue_script() { if(‘myPostType’ == get_post_type() && have_posts()) { wp_register_script( ‘js_script’, plugin_dir_url(__FILE__).’js/script.js’, array(), ‘1.8.5’ ); wp_enqueue_script(‘js_script’); $myCustomValue = array(); while(have_posts()) { the_post(); $mypostid = get_the_ID(); $myCustomValue[”.$mypostid] = nl2br(get_post_meta($mypostid, ‘custom_value’, true)); } // end while rewind_posts(); wp_localize_script(‘js_script’, ‘myCustomValue’, $myCustomValue); } // end if }

Enqueued scripts and styles loading in WordPress Dashboard as well

The “init” action runs both on frontend page loads, and on backend page loads. Try hooking these to the “wp_enqueue_scripts” action instead. I believe it does not run on admin page loads. Example Code: (By OP) function wpse54388_scripts_styles() { wp_enqueue_style( … ); wp_enqueue_script( … ); } add_action( ‘wp_enqueue_scripts’, ‘wpse54388_scripts_styles’ );

wp_enqueuescript won’t load in footer even with true value set?

You need top put it into an actual function and then call the function via an action, but to answer your question. wp_register_script(‘easy-slider’,get_bloginfo(‘template_directory’) . “/js/easySlider1.7.js”, true); Your setting the third parameter to true but that param is for the $deps (dependency). The footer is the 5th parameter called $in_footer. So it should be: wp_register_script(‘easy-slider’,get_bloginfo(‘template_directory’) . … Read more

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