Functions

Generates the inline script for a categories dropdown field.

build_dropdown_script_block_core_categories(string $dropdown_id) : string
package gutenberg

Parameters

$dropdown_id

string

ID of the dropdown field.

Returns

stringReturns the dropdown onChange redirection script.

Get the post title.

gutenberg_draft_or_post_title(integer|\WP_Post $post = 0) : string

The post title is fetched and if it is blank then a default string is returned.

Copied from wp-admin/includes/template.php, but we can't include that file because:

  1. It causes bugs with test fixture generation and strange Docker 255 error codes.
  2. It's in the admin; ideally we shouldn't be including files from the admin for a block's output. It's a very small/simple function as well, so duplicating it isn't too terrible.
package gutenberg
since 3.3.0

Parameters

$post

integer\WP_Post

Optional. Post ID or WP_Post object. Default is global $post.

Returns

stringThe post title if set; "(no title)" if no title is set.

Renders the `core/latest-comments` block on server.

gutenberg_render_block_core_latest_comments(array $attributes = array()) : string
package gutenberg

Parameters

$attributes

array

The block attributes.

Returns

stringReturns the post content with latest comments added.

Register archives block.

register_block_core_archives() 
package gutenberg

Registers the `core/categories` block on server.

register_block_core_categories() 
package gutenberg

Registers the `core/latest-posts` block on server.

register_block_core_latest_posts() 
package gutenberg

Registers the `core/shortcode` block on server.

register_block_core_shortcode() 
package gutenberg

Renders the `core/archives` block on server.

render_block_core_archives(array $attributes) : string
package gutenberg
see

Parameters

$attributes

array

The block attributes.

Returns

stringReturns the post content with archives added.

Renders the `core/block` block on server.

render_block_core_block(array $attributes) : string
package gutenberg

Parameters

$attributes

array

The block attributes.

Returns

stringRendered HTML of the referenced block.

Renders the `core/categories` block on server.

render_block_core_categories(array $attributes) : string
package gutenberg

Parameters

$attributes

array

The block attributes.

Returns

stringReturns the categories list/dropdown markup.

Renders the `core/latest-posts` block on server.

render_block_core_latest_posts(array $attributes) : string
package gutenberg

Parameters

$attributes

array

The block attributes.

Returns

stringReturns the post content with latest posts added.

Performs wpautop() on the shortcode block content.

render_block_core_shortcode(array $attributes, string $content) : string
package gutenberg

Parameters

$attributes

array

The block attributes.

$content

string

The block content.

Returns

stringReturns the block content.