wp_register_script and wp_register_style when shortcode is used

Your scripts and styles all share the same handle, “fancybox”, which should be unique, and I think that’s your issue. Try this: wp_register_script( ‘mousewheel’, get_stylesheet_directory_uri(‘/js/jquery.mousewheel-3.0.6.pack.js’, __FILE__), array(‘jquery’), ‘3.06’, true ); wp_register_script( ‘fancybox-script’, get_stylesheet_directory_uri(‘/js/jquery.fancybox.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( ‘fancybox-pack’, get_stylesheet_directory_uri(‘/js/jquery.fancybox.pack.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( ‘fancybox-buttons’, get_stylesheet_directory_uri(‘/js/jquery.fancybox-buttons.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( … Read more

new to javascript – using in instead of functions.php, not loading correctly

Start by putting your JS in an appropriate .js file in your theme directory. Use the wp_enqueue_scripts hook (this is where you will enqueue/load any of your custom javascripts). Within that hook, use wp_enqueue_script() to load your script(s). Example: add_action( ‘wp_enqueue_scripts’, ‘enqueue_my_stuff’ ); function enqueue_my_stuff () { wp_enqueue_script(‘slug_for_your_script’ , get_template_directory_uri() . ‘/path/to/yourscripts.js’, array(‘jquery’) ); }

Theme now uses require.js and enqueue script no longer works

If the script is there it should work. It’s probably failing because you’re not declaring the jquery dependency and you’re not wrapping it correctly (in no conflict mode). Here’s how your script should be enqueued: function custom_scripts() { wp_enqueue_script( ‘unique-custom-script’, get_stylesheet_directory_uri() . ‘/custom.js’, array(‘jquery’) , false, true ); } add_action( ‘wp_enqueue_scripts’, ‘custom_scripts’, 99 ); And … Read more

how can I make content from a plugin hidden when user is logged in? [duplicate]

“[C]an you give me all options that are possible”? (emphasis added) No, because HTML, CSS, JS, PHP, and WordPress are powerful and sophisticated. Below are are some different approaches, however. [Affiliation: I am not affiliated with any plugins or programs listed here.] is_user_logged_in() In WP, the level closest to the code is to use the … Read more

Trouble figuring out how to get my button to submit comment

Try this. You were missing the tags and the “type” attribute for the tag. The php tag at the bottom echo’s the result that was input in the textarea. Read this http://www.w3schools.com/html/html_forms.asp it should help you get started. <div class=”font-wrap”> <div class=”wrapper”> <form action=”” method=”post”> <textarea name=”comment” id=”comment” class=”talk-bubblecomment” tabindex=”4″ placeholder=”Enter comment…”></textarea> <p class=”sign-in”> Post … Read more

JS file not loading [closed]

You forgot to set dependencies at third parameter put it with array() or array(‘jquery’) if you want to depend on jQuery wp_register_script( ‘navbar-scroll’, ‘http://www.classyclutter.net/wp-content/themes/foodiepro/assets/js/scrolling-navbar.js’, array(), ‘1.0.0’, true);

How to tweak a plugin without preventing it from updating

Create a plugin that dequeues the javascript you don’t want, and enqueues the edited javascript. <?php /** * Plugin Name: Stackexchange Sample * Author: Nathan Johnson * Licence: GPL2+ * Licence URI: https://www.gnu.org/licenses/gpl-2.0.en.html * Domain Path: /languages * Text Domain: stackexchange-sample */ //* Don’t access this file directly defined( ‘ABSPATH’ ) or die(); add_action( ‘wp_enqueue_scripts’, … Read more

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