-// add button in edit pages to help include our form
-function dnxcf_show_form_button() {
- $currentScreen = get_current_screen();
- if ( $currentScreen->parent_base == 'edit' ) {
- echo '<button type="button" id="dnxcf-contact-form" class="button" onclick="dnxcf_send_code()"><span class="dashicons dashicons-testimonial"></span> ' . __( 'Add Contact Form', 'dnxcf' ) . '</button>';
- }
-}
-add_action( 'media_buttons', 'dnxcf_show_form_button', 11 );
-
-// the actual function that outputs our shortcode once the button is pressed
-function dnxcf_insert_shortcode() {
- $currentScreen = get_current_screen();
- if ( $currentScreen->parent_base != 'edit' ) {
- return;
- } ?>
-<script>
- function dnxcf_send_code() {
- //Send the shortcode to the editor
- window.send_to_editor("[dnx_contactform]");
- }
-</script>
- <?php
-}
-add_action( 'admin_footer', 'dnxcf_insert_shortcode' );
-
-