wp_enqueue_script & constants?
The value you pass to wp_enqueue_script should be the URL of the script, not the local file path. wp_enqueue_script(‘my-script’, get_template_directory_uri() . ‘/my-scripts/my-script.js’);
The value you pass to wp_enqueue_script should be the URL of the script, not the local file path. wp_enqueue_script(‘my-script’, get_template_directory_uri() . ‘/my-scripts/my-script.js’);
I had a similar issue once. I found that running the add_action call outside the conditional worked. So try this: function js_custom() { if ( is_page(273) ) { wp_register_script( ‘js_custom’, get_template_directory_uri() . ‘/js/custom.js’, false, null); wp_enqueue_script( ‘js_custom’ ); } } add_action(‘wp_enqueue_scripts’, ‘js_custom’, 50);
You are using iframe in tab structure.So, 1) When page loads fully, the iframe in itenary tab has display none. so it is not loading the zoomed map properly. 2) When you switch to itenary tab before loading completes, iframe is display block i.e visible so it loads the url/map properly. So for this what … Read more
You need the unfiltered_html capability to write JavaScript in post content. This is granted by default to administrators and editors. The better way would be to write a small plugin that provides you a shortcode: <?php /** * Plugin Name: WPSE 234978 – Provide shortcode for Sharpspring embed * Plugin URL: http://wordpress.stackexchange.com/q/234978/31323 * License: MIT … Read more
That worked for me: wp_enqueue_script( ‘YOUR_SCRIPT_NAME’, get_stylesheet_directory_uri() . ‘/YOUR_SCRIPT_FILE.js’, array(), ‘4.7.3’, true ); Notes: I usually name the script just as its file name. You don’t have to use the version number 4.7.3, but you do need to write some plausible version number (like of your WordPress core version) or the keyword null instead.
You’re right, that doesn’t work… yet. We didn’t add support for the dropdown-pages control in #30738 because we wanted to leverage the REST API for this control to fetch the pages. So in 4.9 this is the only base control that requires server-side rendering in core. However, in 4.9 it is easy to provide our own … Read more
This is a react related issue, so I suggest you take a look at Components and Props. In this case the edit function passes an argument, which is an object, and we can call props: registerBlockType(“my-plugin/my-block”, { //… edit: props => { return <MyComponent {…props} />; } }); This way of spreading would be the … Read more
So I’m wondering if anyone might know how I could use VB.net for my calculators on my WordPress website. Directly? No, you can’t run .Net in a browser, and the closest available is silverlight and activeX, both of which were discontinued. As I understand it, the problem is that VB.net doesn’t run on an Apache … Read more
This took me a while to figure out… It’s a bug. The JavaScript error occurs because the onFilterValueChange function is not defined… Even though the WordPress documentation says this function is optional. Simply adding onFilterValueChange with an anonymous function removes the JavaScript error. E.g. <ComboboxControl label=”Font Size” value=”small” options={[ { value: “small”, label: “Small” }, … Read more
Check out this tutorial by kaiser and go step by step: Every time I register a script and add jquery as dependency, it gets added to the <head> in the finally rendered HTML page. As this blocks page rendering time – the included script might modify the DOM – I want to add it to … Read more