jtsternberg / Shortcode_Button

Tinymce and Quicktag buttons for outputting shortcodes. Built to work with CMB2.
81 stars 7 forks source link

Loader class is not working. #13

Closed angelyarmas closed 7 years ago

angelyarmas commented 7 years ago

Using the example code in the main page i got an error Class 'Shortcode_Button' not found in C:\wamp\www\wordpress\wp-content\plugins\shortcode-test\shortcode-test.php

it seems that the problem is related to the loader class. $button = new Shortcode_Button( $button_slug, $js_button_data, $additional_args );

i'm using the latest wordpress and CMB2 versions in a new wordpress enviroment.

jtsternberg commented 7 years ago

I updated the readme example. Please try again with that updated example.

angelyarmas commented 7 years ago

i got this error now, image

for this section

/**
 * Callback dictates that shortcode button will only display if we're on a 'page' edit screen
 *
 * @return bool Expects a boolean value
 */
function shortcode_button_only_pages() {
    if ( ! is_admin() ) {
        return false;
    }

    $current_screen = get_current_screen();

    if ( ! isset( $current_screen->parent_base ) || $current_screen->parent_base != 'edit' ) {
        return false;
    }

    if ( ! isset( $current_screen->post_type ) || $current_screen->post_type != 'page' ) {
        return false;
    }

    // Ok, guess we're on a 'page' edit screen
    return true;
}
jtsternberg commented 7 years ago

ha, ok, just updated the example again. :)

angelyarmas commented 7 years ago

Thanks man, that fixes it.