jQuery on Underscores menu

You haven’t passed jquery as a dependency for your script, and you are using the dollar sign too, which is not directly supported in WordPress due to conflict. First, pass jQuery as a requirement while enqueuing your navigation.js: wp_enqueue_script( ‘themename-navigation’, get_template_directory_uri() . ‘/js/navigation.js’, array(‘jquery’), ‘20151215’, true ); Then, wrap your code in a self invoking … Read more

wp_enqueue_script being ignored in custom theme

You can better try this way and let me know. function wpb_adding_scripts() { wp_enqueue_style( ‘slider’, get_stylesheet_directory_uri() . ‘/css/calculator.css’); wp_enqueue_script(‘jquery’); wp_enqueue_script(‘calculator_script’, get_stylesheet_directory_uri() . ‘/js/calculator.js’); } add_action( ‘wp_enqueue_scripts’, ‘wpb_adding_scripts’ );

Can’t get JS code to work with shortcode

You need to return the Shortcode generated string, not echo, like this: function gg_product_front_end() { wp_register_script( ‘gg_loadProducts_frontEnd’, plugins_url( ‘js/front_end.js’, __FILE__ ), array( ‘jquery’ )); wp_enqueue_script( ‘gg_loadProducts_frontEnd’ ); return ‘<p id=”test”>Test!</p>’; } Also, you need to call the JavaScript function, like this: function gg_loadProducts_frontEnd() { console.log( ‘Test!’ ); } gg_loadProducts_frontEnd(); Otherwise Test! will not be logged … Read more

Select2 in WordPress

It’s not. They may have been planning it for 4.1 or 4.2, as suggested in your link, but for whatever reason it never happened. You can see a list of core-registered scripts that you include here. Another thing to keep in mind is that many (arguably too many) plugins enqueue their own version of the … Read more

Enqueue script with url_query variables?

I can’t get super specific without a more-detailed example from you, but I think you could combine get_query_var() and wp_enqueue_script() to do what you want like this: add_action( ‘wp_enqueue_scripts’, ‘sg_scripts’ ); function sg_scripts() { $current_slug = get_query_var( ‘page_name’ ); wp_enqueue_script( ‘sg_custom_js’, get_template_directory_uri() . ‘/js/somefile.php?slug=’ . $current_slug, $dependencies, $version, $in_footer); } (I left the last three … Read more

How to move style from template file to section?

What about putting styles before the function get_header(); <style type=”text/css”>#header { display: none; }</style> <?php get_header();?> <div class=”main-container-of-my-template”></div> <?php get_footer(); ?> However this is not recommended as it loads the styles even before the <html> not within the <head> section of your website, but as per your requirement this could be the only way to … Read more

Enqueueing Scripts on a Custom Top-level Menu Page

You could try replacing if( ‘nonpareil_theme_options’ != $hook ) with if( ‘toplevel_page_nonpareil_theme_options’ != $hook ) if you have the custom menu added like this: add_action(‘admin_menu’, ‘register_custom_menu_page’); function register_custom_menu_page() { add_menu_page(‘Nonpareil options’,’Nonpareil options’, ‘administrator’, ‘nonpareil_theme_options’, ‘nonpareil_theme_display’ ); } Edit: It looks like you are using this admin_enqueue_scripts example in the Codex: http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts#Example:_Target_a_Specific_Admin_Page so in your case … Read more

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