New answers tagged

0

You can avoid to declare that player is a dependency for your javascript file, the problem is that Jquery isn't recognized. Change this line: wp_enqueue_script( 'main', plugins_url( '/main.js' , __FILE__ ),array("jquery","player"),'0.0.3',true); into this: wp_enqueue_script( 'main', plugins_url( '/main.js' , __FILE__ ), ["jquery"] ); Also avoid to ...


0

What you are referring to is typically a combination of ajax and pushState. It's a nifty effect and can add value to the end-user experience. I deployed it on a WordPress site I built a few years ago (take a look here). I used a JavaScript library called Smoothstate that has fairly good docs (at least to get the basics up and running). You can see an ...


0

Service worker only cache origin file, so You dont need to precache cross origin file such as https://fonts.googleapis.com Or you can try from here https://developers.google.com/web/updates/2016/09/foreign-fetch


1

So the issue has already been resolved via the comments and the current state of the question already includes the corrected code. But I thought I should post this answer as a reminder for you, me and everyone reading this. :) So first off, here's a helpful excerpt from an article on WP Engine: The “unexpected end of file” error is not specific to ...


0

Those two scripts are not PHP and should not be inside of functions.php Instead try placing those scripts inside of header.php or inside of your theme's Header Code area. Then the second script you posted should also be added inside of header.php or inside of the theme's Header Code area. Please note that since we do not know which image, class or HTML you ...


3

Mostly no, but you shouldn't do that anyway. The exception, is if your user has the unfiltered_html capability, which is a dangerous power to have. Users that have this are admins on a single site install, or a super admin on a multisite install. But, there are major security downside to putting script and style tags directly into articles. For CSS, it's ...


0

In your functions.php file (you're using a custom child theme, right?) change/add the version parameter to wp_get_theme()->get( 'Version' ) this will pull the version number from your theme's style.css file. https://developer.wordpress.org/reference/functions/wp_enqueue_style/ Setting this parameter to false will use the WordPress version. ...


0

It's using 5.2.3 because no version was specified when style.css was enqueued/registered. So it fell back to the version of WordPress. If you pass in a version when calling wp_enqueue_style, it will use that value instead


-1

Change the version number in your style.css file. Edit: I misunderstood. I think that's the WordPress version.


0

You're using the incorrect hook. The only hook is wp_enqueue_scripts (plural). You use wp_enqueue_style() and wp_register_script() etc. on that hook, but the hook is always the same. So this: add_action('wp_enqueue_script' , array( $this, 'initBootstrap' )); add_action('wp_enqueue_style' , array( $this, 'initBootstrap' )); add_action('wp_register_script' , ...


0

It is possible that your caching plugins are preventing the script from loading. Your site may also be http and not https, hence the reason why https script cannot load. Try changing the script to http: <script src="http://www.palloliitto.fi/torneopal/ajax/[torneopal:scoretable:competition=splfutsal1920%26amp;class=FL%26amp;group=1%26amp;key=XHGVMHFIQB]"&...


1

You're using get_next_post and get_previous_post correctly with get_permalink. The next and prev functions either return a WP_Post object or a falsy value. The permalink function accepts either a post object or a valid post ID and returns the post url as string, if it was found, otherwise it returns boolean false. I tested the code you've posted by copy-...


0

No any mistake in you code only just remove one line from you code. Please remove first line from your code : add_shortcode('WCAlphabeticalBrands', 'WCAlphabeticalFunc_Cleanse');


0

What you want to do is relatively easy, if you are familiar with Wordpress Theme modifications. The following will assume you are at least comfortable with PHP, and hopefully Wordpress Theme modification. If not, I can provide some additional links in subsequent updates to this answer ... just let me know. First step: Gravity Forms documentation has ...


0

You're almost there, change code in functions.php to: <?php function my_theme_enqueue_styles() { $parent_style = 'divi-style'; wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ), ...


1

The nonce authentication method is only for requests made from within WordPress, as described in your own link (emphasis mine): It is important to keep in mind that this authentication method relies on WordPress cookies. As a result this method is only applicable when the REST API is used inside of WordPress and the current user is logged in. In ...


1

You can't send the data to admin-ajax.php as JSON: data: JSON.stringify({ action: "process_coupon" }), For the wp_ajax_ actions to be fired, WordPress checks $_REQUEST['action'], but this is not populated by PHP when the form is submitted as JSON. The correct way to send the request with jQuery is to pass the data like this: data: { action: "...


0

Easy way to achieve your goal, use WPForms This have a feature like Multi page form


0

We can indeed conditionally load CSS and JS files via shortcode conditionally, when the shortcode is present and without using any overly elaborate functions: Refer to comment #348349 here: Enqueue Scripts / Styles when shortcode is present


1

Solution provided by Steven <script type="text/javascript"> ( function() { coll = document.getElementsByClassName("col"); conn = document.getElementsByClassName("con"); var i; for (i = 0; i < coll.length; i++) { coll[i].setAttribute('data-id', 'con' + i); conn[i].setAttribute('id', 'con' + i); coll[i]....


0

This solution didn't exist at the time this question was asked, but since I was led here in my quest to find an answer, I figure it might help someone else. I'm not sure how to capture the upload event as I'm using CMB2's event cmb_media_modal_select, but setting the featured image is as simple as: wp.media.featuredImage.set(id) More on this portion of ...


Top 50 recent answers are included