Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Allow for more content blocks in WordPress than just the one.
branch: master

README.md

Multiple content blocks

Allow for more content blocks in WordPress than just the one.

Installation

If you're using Composer to manage WordPress, add this plugin to your project's dependencies. Run:

composer require trendwerk/multiple-content-blocks 3.2

Or manually add it to your composer.json:

"require": {
    "trendwerk/multiple-content-blocks": "3.2"
},

How to use

Place one of the template tags in a WordPress template. When that template is used, an extra editor will appear in the back-end.

Template tags

the_block( $name, $args )

This will display the $name content block

get_the_block( $name, $args )

This will get $name content block's content, for you to process

has_block( $name, $args )

Will check if a block exists and has content

Additional arguments

the_block( $name, array(
    'label'         => __( 'Admin label', 'text-domain' ),
    'type'          => 'one-liner',
    'apply_filters' => false,
) );

label

(string) Label for the admin area.

Default: None

type

(string) The type of content block.

Default: editor

  • editor: WordPress' WYSIWYG editor.
  • one-liner: A plain one line text field.

apply_filters

(boolean) Whether to apply the_content filters or not.

Default: true

Something went wrong with that request. Please try again.