Skip to content

Commit

Permalink
enqueue shortcodes startic later
Browse files Browse the repository at this point in the history
  • Loading branch information
moldcraft committed May 27, 2015
1 parent 893789b commit 2b42e43
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions class-fw-extension-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,23 @@ protected function _init()
add_action('fw_extensions_init', array($this, '_action_fw_extensions_init'));

// renders the shortcodes so that css will get in <head>
add_action('wp_enqueue_scripts', array($this, '_action_enqueue_shortcodes_static_in_frontend_head'));
add_action(
'wp_enqueue_scripts',
array($this, '_action_enqueue_shortcodes_static_in_frontend_head'),
/**
* Enqueue later than theme styles
* https://github.com/ThemeFuse/Theme-Includes/blob/b1467714c8a3125f077f1251f01ba6d6ca38640f/init.php#L41
* to be able to wp_add_inline_style('theme-style-handle', ...) in 'fw_ext_shortcodes_enqueue_static:{name}' action
* http://manual.unyson.io/en/latest/extension/shortcodes/index.html#enqueue-shortcode-dynamic-css-in-page-head
* in case the shortcode doesn't have a style, needed in step 3.
*/
30
);
} elseif (
defined('DOING_AJAX') &&
DOING_AJAX === true &&
FW_Request::POST('fw_load_shortcodes')
) {

// load the shortcodes if this was requested via ajax
add_action('fw_extensions_init', array($this, '_action_fw_extensions_init'));
}
Expand Down

0 comments on commit 2b42e43

Please sign in to comment.