This reference covers the PHP functions, filter hooks, and action hooks exposed by WebberZone Snippetz for use in themes and plugins.
All functions are in the WebberZone\Snippetz\Snippets\Functions class. All hook names are prefixed ata_.
PHP functions
Functions::get_snippet_content( $snippet, $args )
Returns the rendered output for a snippet.
Parameters:
$snippet(int|WP_Post): Snippet ID or post object.$args(array, optional): Output arguments.class(string): Extra CSS class on the wrapper<div>. Default''.is_block(bool): Mark output as block-rendered. Addsata_snippet_blockclass. Defaultfalse.is_shortcode(bool): Mark output as shortcode-rendered. Addsata_snippet_shortcodeclass. Defaulttrue.
Returns: string: Rendered snippet output, or an error string if the ID is invalid. Returns an empty string for an unpublished or disabled snippet unless the current user has edit_post permission for that snippet.
Functions::get_snippets_by_location( $location, $numberposts )
Returns all active snippets assigned to a given location.
Parameters:
$location(string): One ofheader,footer,content_before,content_after.$numberposts(int, optional): Maximum number to return. Default-1(all).
Returns: WP_Post[]|int[]|false: Array of snippet post objects, or false if location is invalid.
Functions::get_header_snippets( $numberposts )
Shorthand for get_snippets_by_location( 'header' ).
Functions::get_footer_snippets( $numberposts )
Shorthand for get_snippets_by_location( 'footer' ).
Functions::get_content_before_snippets( $numberposts )
Shorthand for get_snippets_by_location( 'content_before' ).
Functions::get_content_after_snippets( $numberposts )
Shorthand for get_snippets_by_location( 'content_after' ).
Functions::get_snippets( $args )
Query snippets using get_posts() arguments.
Parameters:
$args(array): Acceptsnumberposts,include,exclude, and anyWP_Queryargument.post_typeis always forced toata_snippets.
