Closed xballoy closed 3 years ago
What's a category description? Is that an excerpt?
My theme uses https://developer.wordpress.org/reference/functions/category_description/ under the hood to get the description. Does it answer your question?
I'll test this out and get back to you. Thanks
At first look, it appears I had to add do_shortcode
to the category_description
function; but I doubt that's your problem if you already have the HTML being rendered. Are there any JS problems in the developer tools?
here's what's working for me:
Basically my theme is doing
<?php if (!empty($content['desc'])): ?>
<?php echo wpautop( $content['desc'] ); ?>
<?php endif; ?>
I didn't notice yesterday but the script is wrapped in a p
tag
If I change my theme to remplace wpautop
by do_shortcode
the script is not wrapped anymore but I still do not download Leaflet script. I cannot see any request to get it in the network panel.
Some more information:
That helps. So for some reason the javascript is not being enqueued. I'm guessing there's a problem with the logic I added to the map shortcode class; that, or your theme is doing something funky:
I might just change it to use wp_script_is: https://developer.wordpress.org/reference/functions/wp_script_is/
if you're able to download v2.23.1 once it's published let me know if that works!
@bozdoz v2.23.0 worked fine here, but v2.23.1 the tiles are all messed up. It's no longer in a specified width container, but it overflows everywhere and there is spacing between them.
Looking at the commit, maybe the wp_leaflet_map is enqueued, but the stylesheet isn't enqueued as it comes after the return?
🎉
It's working fine now, thanks a lot!
I think I see it; I think did_action is what I want: https://developer.wordpress.org/reference/functions/did_action/
The issue I encountered is also gone in the latest (v2.23.2) version. Cheers!
Not working anymore with 2.23.2 :( The script don't enqueue anymore
v2.23.3 should be a fine compromise. I'm not sure if anyone is even using the leaflet_map_enqueue action. It may have been added just as an option. I thought it should fire only once, but probably won't matter, and there are better custom ways to deal with it if it does. Having each map enqueue the required javascript and css should solve any asynchronous problems that may be happening.
v2.23.3 works for me 🚀
v2.23.3 also works fine here 👍
First of all I'm not 100% sure if it's an issue with the plugin / my theme or Wordpress.
My issue When I add a leaflet shortcode in my category description the JavaScript and the CSS don't load.
Steps to reproduce:
but the map is not displayed and no JS / CSS is loaded
However it works when I add it on a post.