array elements in callback

Support MB Blocks array elements in callbackResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #45847
    Topher DeRosiaTopher DeRosia
    Participant

    I'm making a block with MB Blocks. I'm having trouble with the callback. here's my callback:

    function hba_hours( $attributes ) {
    
        // Fields's data.
        if ( empty( $attributes['data'] ) ) {
            return;
        }
    
        $prefix = 'hba_blocks_';
    
        $title = $attributes( $prefix . 'hours_title' );
        $hours = $attributes( $prefix . 'hours' );
    
        echo '<h4>' . $title . '</h4>';
        return '<p>' . $hours . '</p>';
    }

    I get a 500 that starts with this:

    <b>Fatal error</b>:  Uncaught Error: Array callback must have exactly two elements in /home/customer/www/heartsideb.sg-host.com/public_html/wp-content/plugins/heartside-blocks/heartside-blocks.php:74
    Stack trace:
    #0 [internal function]: hba_hours(Array)

    I don't even know what question to ask here. What's wrong?

    #45848
    Topher DeRosiaTopher DeRosia
    Participant

    Never mind, I see it. array variables.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.