• Resolved 647np

    (@647np)


    Hi!

    Thank you for such an awesome plugin.

    I was wondering if there is way to add a custom button in one of the widgets(EA Advanced Accordion widget)
    I wanted to add a button( from a different plugin-document gallery) which appears in the classic editor but I want it in the EA Advanced accordion widget as well. From the support forums of the document gallery plugin, I found out that to insert that button in the classic editor, we need to paste the code in the functions.php file of the wordpress theme. But I don’t exactly know where to paste the code so that the button appears in the elementor addon widget. The code is as follows:

    function dg_specific_button_js() { ?>
    <script type="text/javascript">
        function open_dg_tab() {
            if ( this.frame === undefined ) {
                if ( wp.media.frame !== undefined && jQuery.inArray(wp.media.frame.state().id, ['dg', 'dg-edit', 'dg-library'])<0 ) {
                    wp.media.frame.setState('dg');
                }
                var options = {
                    frame: 'post',
                    state: 'dg',
                    title: DGl10n.dgMenuTitle,
                    multiple: true
                };
                this.frame = wp.media.editor.open(null, options);
            } else {
                if ( jQuery.inArray(this.frame.state().id, ['dg', 'dg-edit', 'dg-library'])<0 ) {
                    this.frame.setState('dg');
                }
                this.frame.open();
            }
            return false;
        }
        jQuery(document).ready( function() {
            if ( typeof wp.media.collection !== 'function' ) return;
    	jQuery('#dg-specific-button').removeAttr('disabled').click(open_dg_tab);
        } );
    </script>
    <?php }
    function dg_check_page_type( $hook ) {
        if ( in_array( $hook, array( 'post.php', 'post-new.php' ), true ) ) {
            function dg_add_specific_button() {
                echo '<button id="dg-specific-button" class="button" disabled>'.__( 'Create Document Gallery', 'document-gallery' ).'</button>';
            }
            add_action('media_buttons', 'dg_add_specific_button');
            add_action('admin_print_footer_scripts', 'dg_specific_button_js');
        }
    }
    add_action('admin_enqueue_scripts', 'dg_check_page_type');

    Thank you and sorry for the trouble.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Rafin

    (@rafinkhan)

    @647np,

    Hi, there. Thank you for your interest in our Plugin. Unfortunately, as per our support policy, we are unable to provide support for customization of our plugin. Since customization without proper testing can break the whole plugin if done wrong, we do not encourage anyone to do it as well.

    So, I hope you understand it. Thank you.

    Thread Starter 647np

    (@647np)

    Thank you for your reply. I completely understand.
    There was one more thing I wanted to ask. I wanted to insert two images(with link to external url) side by side in the EA Advanced accordion. But every time I insert those images; the second image appears at the bottom of the first image. What do I do?

    Thanks and sorry for the trouble.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom button(from different plugin) in EA Advanced accordion widget’ is closed to new replies.