Skip to content

Commit

Permalink
Add the second attribute "content"
Browse files Browse the repository at this point in the history
Add the second attribute "content" to the attributes list.

Include new attribute "content" in edit: and save: functions.

Note: Now that we're passing multiple values as children of the div, we
pass an array of calls to el().
  • Loading branch information
salcode committed May 23, 2018
1 parent 4521639 commit 427ae2a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion blocks/iron-code-two-elements.php
Expand Up @@ -56,7 +56,8 @@ function iron_code_two_elements_block_init() {

/**
* Attributes are the editable variables in our block.
* Here we create one attribute called "heading" (we could use any name here).
* Here we create one attribute called "heading" (we could use any name here)
* and a second attribute called "content" (again any name would work).
*
* When the editor is loaded, the attributes are populated by parsing the
* block as it is stored in the database and extracting the values.
Expand All @@ -72,6 +73,11 @@ function iron_code_two_elements_block_init() {
'selector' => 'h2',
'source' => 'text',
),
'content' => array(
'type' => 'string',
'selector' => 'p',
'source' => 'text',
),
);

register_block_type( 'learn-iron-code-block-two-elements/iron-code-two-elements', array(
Expand Down

0 comments on commit 427ae2a

Please sign in to comment.