Closed nicoladj77 closed 6 years ago
Hi, for a UI reason I would want to add buttons to the Shortcake UI postMediaFrame that, when clicked, perform a custom js action.
To add a button I can simply do:
add_filter('shortcode_ui_shortcodes', function($shortcodes){ $shortcodes['section'] = [ 'label' => 'Section', 'shortcode_tag' => 'section', 'listItemImage' => 'dashicons-forms', 'attrs' => [], ]; return $shortcodes; });
Which adds a button ( The fourth one )
What I would like to do is that, when I click the new button, I run custom js code. What would be the cleanest way to do this?
Enqueue your JavaScript file on post edit pages and add an event to the Section element with preventDefault()
Closing unless there are other questions here.
Hi, for a UI reason I would want to add buttons to the Shortcake UI postMediaFrame that, when clicked, perform a custom js action.
To add a button I can simply do:
Which adds a button ( The fourth one )
What I would like to do is that, when I click the new button, I run custom js code. What would be the cleanest way to do this?