CSS styles for Buttons doesn't load within Table shortcode
Hi, Developers!
I would like to clarify, is it a bug, please
my Button shortcode loads some custom CSS via following code (from static.php):
add_action(
'fw_ext_shortcodes_enqueue_static:button',
'_action_shortcode_button_enqueue_dynamic_css'
);
function _action_shortcode_button_enqueue_dynamic_css( $data ) {
$shortcode = 'button';
$atts = shortcode_parse_atts( $data['atts_string'] );
$atts = fw_ext_shortcodes_decode_attr( $atts, $shortcode, $data['post']->ID );
$shortcode_id = 'shortcode-' . $atts['id'];
// do some things and add inline styles here
}
this works fine if i use button as a separate shortcode, but my custom inline styles doesn't load if i use "Button" inside Pricing Table
is there any fix of this?
Thank you
Nope, not a bug. You are responsible for handling it correctly. Call _action_shortcode_button_enqueue_dynamic_css inside the function that renders custom CSS for pricing tables.
Creating reusable functions for this kind of stuff is your job, Unyson can't handle this for you.
sorry, could you write some example how to call
fw_ext_shortcodes_enqueue_static:button
action from Pricing Tables shortcode?
When i add "_action_shortcode_button_enqueue_dynamic_css();" function in "static.php" file (in Table extension), i get "function doesn't exist" error, also i tried do_action('fw_ext_shortcodes_enqueue_static:button'); but it falls with erros:
<b>Warning</b>: Illegal string offset 'atts_string' in <b>\framework-customizations\extensions\shortcodes\shortcodes\button\static.php</b> on line <b>12</b><br />
<br />
<b>Notice</b>: Uninitialized string offset: 0 in <b>\framework-customizations\extensions\shortcodes\shortcodes\button\static.php</b> on line <b>12</b><br />
<br />
<b>Warning</b>: Illegal string offset 'post' in <b>\framework-customizations\extensions\shortcodes\shortcodes\button\static.php</b> on line <b>13</b><br />
<br />
<b>Notice</b>: Uninitialized string offset: 0 in <b>\framework-customizations\extensions\shortcodes\shortcodes\button\static.php</b> on line <b>13</b><br />
<br />
<b>Notice</b>: Trying to get property of non-object in <b>\framework-customizations\extensions\shortcodes\shortcodes\button\static.php</b> on line <b>13</b><br />
<br />
<b>Catchable fatal error</b>: Argument 1 passed to fw_ext_shortcodes_decode_attr() must be of the type array, string given, called in \framework-customizations\extensions\shortcodes\shortcodes\button\static.php on line 13 and defined in <b>\wp-content\plugins\unyson\framework\extensions\shortcodes\helpers.php</b> on line <b>10</b><br />
sorry if this is a noob question, but i can't find any point in documentation regarding this.
So, we have static.php file in Tables shortcode, and is there any way to call "fw_ext_shortcodes_enqueue_static:button" action from Pricing Tables?
Thank you so much!