bizbudding / wampum-popups

A lightweight but flexible WordPress popups plugin utilizing on oiubounce
11 stars 3 forks source link

Hook throws PHP warnings #4

Open yumyo opened 4 years ago

yumyo commented 4 years ago

The code example throws the following error:

PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, 
function 'prefix_do_wampum_popup' not found or invalid function name in /app/wp-includes/class-wp-hook.php on line 288

The same applies if using any other naming.

JiveDig commented 4 years ago

prefix_do_wampum_popup is just an example usage. You can't call that callback without also creating the function with the same name.

yumyo commented 4 years ago

Not sure I am following @JiveDig, I am using the complete example from the readme:

add_action( 'wampum_popups', 'prefix_do_wampum_popup' );

function prefix_do_wampum_popup() {

    // Bail if not a single post
    if ( ! is_singular('post') ) {
        return;
    }

    $content = '// Some HTML';

    $args = array(
        'type'  => 'timed',
        'style' => 'slideup',
    );
    wampum_popup( $content, $args );

}

To which function are you referring to?

JiveDig commented 4 years ago

If you use that exact code it should work. That’s exactly how we use it. Do you have that code or a modified version?