• Resolved koendoit

    (@koendoit)


    Thanks for your crop plugin ??

    Got i question, i’m trying to add a custom crop button. But on a custom taxonomy page i get a console error:
    Uncaught ReferenceError: CROP_THUMBNAILS_VUE is not defined

    Is this because it’s a custom taxonomy?

    Thanks for your time!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    Can you show your code?

    Thread Starter koendoit

    (@koendoit)

        <script>
            jQuery(document).ready(function($) {
                //add a button right beside the add media button - adjust if you want the button somewhere else
                let $hidden = $('.acf-image-uploader > input[type=hidden]');
    
                if($.isNumeric($hidden.val())) {
                    $('.acf-image-uploader').append('<div style="display: flex; width: 100%; padding-top: 15px;"><button type="button" id="myCustomButton" class="button button-primary">Afbeelding croppen</button></div>');
    
                    let $imageValue = $hidden.val();
    
                    $('#myCustomButton').click(function() {
                        /**
                         * the ID of the image you want to open
                         * you may want to read the value by javascript from somewhere
                         **/
                        let attachementId = $imageValue;
    
                        /** the posttype decides what imagesizes should be visible - see settings **/
                        // let postType = 'producten_categories';
    
                        /** the title of the modal dialog */
                        let title = 'test';
    
                        /** lets open the crop-thumbnails-modal **/
                        let modal = new CROP_THUMBNAILS_VUE.modal();
                        modal.open(attachementId, title);
                    });
    
                }
    
            });
        </script>
    • This reply was modified 4 years, 5 months ago by koendoit.
    Thread Starter koendoit

    (@koendoit)

    I did also a test on a custom post type, there it is working. but for a custom taxonomy it is not working. There a get the error: Uncaught ReferenceError: CROP_THUMBNAILS_VUE is not defined

    Thanks for your time!

    • This reply was modified 4 years, 5 months ago by koendoit.
    • This reply was modified 4 years, 5 months ago by koendoit.
    Thread Starter koendoit

    (@koendoit)

    The error also occurs on ACF option pages. Just tried.

    Error img:
    https://ibb.co/1sJRHNW

    Thanks

    Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    You have to add the Javascript and CSS of the plugin on that pages.
    You can do so, by adding/modifiing the following code to your theme:

    
    add_filter('crop_thumbnails_activat_on_adminpages', function($oldValue) {
    	global $pagenow;
    	return $oldValue || $pagenow==='term.php';//for adding taxonomy edit-page to the list of pages where crop-thumbnails work
    });
    
    Thread Starter koendoit

    (@koendoit)

    Thanks works ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom crop button for taxonomy: Uncaught ReferenceError: CROP_THUMBNAILS_VUE’ is closed to new replies.