Support » Plugin: Multiple content blocks » Transfer block information to array

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Harold Angenent


    Sure, you can put almost anything in an array. But I don’t fully understand what you mean.

    You want to put the content of a block in an array? Like this?

    $my_array = array( get_the_block( 'My block' ) );

    Hi Harold.

    I have installed the multiple blocks plugin to allow the user to manage the postcodes allowed.



    So I then want to explode this into an array as such:

    $var = array(“BT1AAA”,”BT1BBB”,”BT1CCC”,”BT1DDD”);



    Plugin Author Harold Angenent


    Okay.. this is kind of a PHP question and unrelated to our plugin, but I can give you some pointers:

    $postal_codes = get_the_block(  'Postal codes' ); //Or whatever the name is
    $postal_codes = explode( ',', $postal_code ); //Comma separated

    You’re a Gentleman. I’ll give that a go.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Transfer block information to array’ is closed to new replies.