New answers tagged

0

Thanks for rewriting the question: It seems much clearer now. Sorry for the protracted comments earlier, but I wasnt on my laptop. I corrected a couple of typos in your code and pasted this into my functions.php: // include files via shortcode function include_file($atts) { extract(shortcode_atts(array('filepath' => NULL), $atts)); if ($...


2

Problem The Short Version The problem isn't how you're using those scripts or where you're placing them - it's how the authors of those scripts wrote them. The Long Version Your "superfish" script which controls the functionality of your navigation menu is throwing errors because $.browser is undefined. While $.browser was deprecated more than 3 years ...


0

I think the simplest solution, without having more details about site A or site B, would be to use a service like Zapier to make your connection.


2

Here's one demo suggestion: add_action( 'admin_enqueue_scripts', function() { wp_enqueue_script( 'my-script', '/my-script.js', ['underscore', 'backbone'], '1.0' ); wp_add_inline_script( 'my-script', 'alert("hello world");' ); // Add our template if( function_exists( 'wpse_add_inline_tmpl' ) ) wpse_add_inline_tmpl( $handle =...


0

Decided to go a different route. For whatever reason couldn't get the Headroom.js to add CSS classes to the target in Wordpress, worked fine in plain HTML but wouldn't register with Wordpress. Still unsure if it has anything to do with how I enqueued the scripts but everything else works so unsure. Decided to remove the plugin and use a custom built JS ...


0

Changing img: obj_test.stylesheet_directory_uri + '/img/ajax-loader.gif', to img: "http:// urltoimage .com/test.gif", solve the problem. Important - the url between '...' does not work! The url must be between "..." That was the problem i dont figured out before :)


1

Copying from the answer here regarding variable scope Variables inside a function are only available inside that function. Variables outside of functions are available anywhere outside of functions, but not inside any function. Because of that, you need to add your $translations array within the kvkoolitus_load_comment_validation function, like ...


0

Here's a slightly different way of doing it, replacing the existing enqueued script with the CDN and adding a fallback. Also matches to your existing jQuery version in WordPress. Found it pretty reliable in practice: add_action('wp_enqueue_scripts','jquery_cdn_with_fallback'); function jquery_cdn_with_fallback() { global $wp_version; // get the ...


0

Add your fallback code into a plugin and save your plugin in the MU folder: http://codex.wordpress.org/Must_Use_Plugins. Then this will run before any other plugins


0

I enqueued the child script the right way and made the first Reference Error (eltdGlobalVars) disappear as follows: In functions.php in child I removed lines that dequeue the script "search_and_go_elated_listing". Then I enqueued it using a copy of the function with the same name as the pluggable function in parent: "search_and_go_elated_listing_assets". ...


1

You need to wrap your text with <?php and ?>. Like this: <?php function my_scripts() { wp_enqueue_script( 'jquery' ); wp_register_script( 'parallax', get_template_directory_uri() . '/parallax.js', array( 'jquery' ), NULL, true ); wp_enqueue_script( 'parallax' ); } add_action( 'wp_enqueue_scripts', 'my_scripts' ); ?> Otherwise, ...


1

Take a look at a plugin called Better REST API Featured Image. It adds the featured image URL to the original API response.


0

You got javascript file and CSS file! Then you have to put those files in you child theme folder like themes -> your_child_theme_folder -> js(if you dont have js folder then create one) and place your js file here AND you have to put you css file in css folder inside your child theme. Now you need to call js file from functions.php If you dont ...


0

For editing content, I used the plugin Advanced Custom Fields. As for the conditionals, I just added if (is_page_template('template_name.php') before each wp_enqueue_script.


9

Each of the files you have mentioned are theme files. When you upgrade WordPress itself, it will not touch any themes (or plugins) you have installed, whether or not you have modified them. If this was a theme you created yourself, then you have no worries at all. However, if this was a theme created by someone else, for example a WordPress default theme, ...



Top 50 recent answers are included