April 21, 2013 at 3:17 pm #12318
I’m using MapPress in combination with the GroupBuyingSite plugin (GBS for short – http://www.groupbuyingsite.com). I’ve integrated the plugins together pretty nicely, but there is one template that does not call wp_footer (for good reason). Maps on those pages are not displaying…yet.
Can anyone suggest any alternatives? Can I hardcode the stylesheet/script enqueues into that template? If so, what would be the best way to do that?
MichaelApril 21, 2013 at 5:41 pm #12320
Just to be clear, wp_footer() only loads scripts in the footer. It doesn’t actually display the blog footer – that’s done by get_footer() instead.
Were you thinking of get_footer()?
If that’s not the problem and you really can’t call wp_footer(), then you could possibly just trigger action ‘wp_print_footer_scripts’ instead, e.g. do_action(‘wp_print_footer_scripts’). That calls the internal function to queue all the scripts.April 21, 2013 at 8:51 pm #12321
Thanks. The page I’m having trouble with is a receipt-type page that is meant to be printed. The template for this view does not call wp_footer(), and no external scripts or stylesheets are loaded.
If I add wp_footer() or do_action(‘wp_print_footer_scripts’), then my site’s stylesheet and all other scripts are loaded even though they should not be on this view (including mappress’s).
Is there a way to selectively load MapPress resources for this template, or any other way I can work around this limitation?April 22, 2013 at 5:14 am #12329
I don’t think WordPress offers any way to output only specific queued scripts.
You could take a look at a normal page with a map and just copy the google/mappress script tags into your checkout page template. Call the MapPress print_maps() function to output the map data after those tags:
Perhaps there’s a way to conditionally not load the other scripts on the checkout page? Or you could dequeue them before the wp_footer() call:April 22, 2013 at 6:03 am #12330
Thanks, I got it working!
Right now, I just copied var mappl10n from a different page with a map on it. Is that unwise? Should I dynamically generate this content? How?April 22, 2013 at 6:35 am #12331
I assume you just copied over the script tags? I forgot about mappl10n, though – you can output it by calling $mappress->l10n();
I still think it would be better to just deuque/deregister the scripts you don’t want, though – that way if MapPress changes you won’t need to re-do the checkout page.April 22, 2013 at 6:58 am #12332
$mappress->l10n(); isn’t outputting anything for me for some reason:
I agree this isn’t an ideal setup, but I need to get this sorted for launch. We’ll develop a smarter way to do this soon after.April 22, 2013 at 7:01 am #12334
- You must be logged in to reply to this topic.