wp-shortcake / shortcake-bakery

A fine selection of shortcodes for WordPress
42 stars 16 forks source link

Explicitly enqueue Facebook API script in the footer #147

Closed danielbachhuber closed 8 years ago

danielbachhuber commented 8 years ago

Registering and then calling wp_enqueue_script() doesn't do what we need it to.

Fixes #146

danielbachhuber commented 8 years ago

@goldenapples I'm not sure why I used wp_register_script() in the first place, or whether it worked originally and has since broken. Do you recall?

I suppose we haven't noticed it in the Fusion theme because we're loading the Facebook API SDK through other means.

@montchr Can you check out this branch locally and confirm the fix?

goldenapples commented 8 years ago

I'm not sure why I used wp_register_script() in the first place, or whether it worked originally and has since broken. Do you recall?

Nope. Registering and enqueuing should be the same behavior as just enqueueing while providing all the dependency information. But we weren't passing the in_footer flag, and it's too late by the time the shortcode callback is run to print with the header scripts.

Like you say, since we're loading Facebook SDK elsewhere, I suspect we just never noticed.

danielbachhuber commented 8 years ago

@goldenapples #reviewmerge

goldenapples commented 8 years ago

Looks good to me.