How to load attributes for button block in a custom post template (PHP)

I figured it out through a tip to look at the Nested templates

Compared to my original code, I needed to nest the button block in an additional array.

I’ve included a working example below for the button block:

Determine which attributes for the block that you need and then define them as an array object as I did below.

array(
	'core/buttons',
	array(
		'contentJustification' => 'center',
	),
	array(
		array(
			'core/button',
			array(
				'text'      => 'your text',
				'url'       => 'https://wordpress.org',
				'className' => 'is-style-name-of-your-style-variation',
			),
		),
	),
),
  • This reply was modified 1 day, 10 hours ago by skorasaurus.



Source link