Skip to content

Commit

Permalink
Merge pull request #51 from torounit/add/filter-param
Browse files Browse the repository at this point in the history
add `attributes` parameter to `advanced_posts_blocks_posts_query` filter.
  • Loading branch information
torounit authored Jul 4, 2023
2 parents f4f7cba + d7fd70a commit 944bc03
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/blocks/class-renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function __construct() {
}

/**
* Regsiter Block Type.
* Register Block Type.
*/
protected function register() {
$block = register_block_type( dirname( PLUGIN_FILE ) . '/build/blocks/' . $this->dirname );
Expand All @@ -82,7 +82,7 @@ protected function register() {


/**
* Getter for attirbutes.
* Getter for attributes.
*
* @return array
*/
Expand Down Expand Up @@ -251,7 +251,16 @@ protected function get_content_from_default_template( string $name ) {
* @param string $query_var query var.
*/
protected function setup_query( array $args, string $query_var = 'query' ) {
$args = apply_filters( 'advanced_posts_blocks_posts_query', $args, $this->name );
/**
* Filters query arguments.
*
* @param array $args query arguments.
* @param string $name block name.
* @param array $attributes block attributes.
*
* @since 0.6.0
*/
$args = apply_filters( 'advanced_posts_blocks_posts_query', $args, $this->name, $this->attributes );
$this->query = new WP_Query( $args );
$this->set_template_args( $query_var, $this->query );
}
Expand Down

0 comments on commit 944bc03

Please sign in to comment.