Recent

Snippetsclass

Snippets

Registers the snippets post type, taxonomy and editor integration.

Namespace: WebberZone\Snippetz\Snippets
Since: 1.7.0
Source: includes/snippets/class-snippets.php line 25

Methods

__construct()

Constructor function.

Line: 80

public function __construct(  );

disable_block_editor()

Disable block editor for snippets post type.

Line: 112

public function disable_block_editor( $use_block_editor, $post_type ): bool;
Type Name Description
bool $use_block_editor Whether to use block editor.
string $post_type Post type.

Returns: bool — Whether to use block editor.

register_post_type()

Register Snippets Post Type.

Line: 124

public function register_post_type(  ): void;

Returns: void

register_taxonomy()

Register WebberZone Snippetz Snippet Category taxonomy

Line: 243

public function register_taxonomy(  ): void;

Returns: void

wp_editor_settings()

Update Editor settings for $this->post_type custom post type

Line: 303

public function wp_editor_settings( $settings, $editor_id ): array;
Type Name Description
array $settings Array of editor arguments.
string $editor_id Unique editor identifier.

Returns: array — Updated settings array.

remove_wpautop()

Remove wpautop when viewing the custom post type.

Line: 324

public function remove_wpautop( $content ): string;
Type Name Description
string $content Post content.

Returns: string — Updated post content.

media_buttons()

Add media buttons.

Line: 335

public function media_buttons( $post );
Type Name Description
\WP_Post $post Post object.

insert_snippet_button()

Add an Insert Snippet button to the Classic Editor.

Since: 2.4.0
Line: 365

public function insert_snippet_button( $editor_id );
Type Name Description
string $editor_id Editor identifier.

insert_snippet_modal()

Render the Insert Snippet modal and its editor integration script.

Since: 2.4.0
Line: 385

public function insert_snippet_modal(  );

media_view_strings()

Edit media strings.

Line: 451

public function media_view_strings( $strings, $post ): string[];
Type Name Description
string[] $strings Array of media view strings keyed by the name they’ll be referenced by in JavaScript.
\WP_Post $post Post object.

Returns: string[] — Updated strings array.

get_snippet_type()

Get snippet type.

Line: 469

public function get_snippet_type( $snippet ): string;
Type Name Description
\WP_Post $snippet Snippet object.

Returns: string — Snippet type.