Skip to content

Commit

Permalink
Add Pod context to settings + re-overwrite post type for UABB if poss…
Browse files Browse the repository at this point in the history
…ible.
  • Loading branch information
JoryHogeveen committed Oct 15, 2020
1 parent 25314ec commit 1da1cc8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pods-beaver-themer.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ function pods_beaver_loop_before_query_settings( $settings ) {

// Add pod name as the post type query.
$settings->post_type = $pod->pod;
// Add pod context to the settings so other filters can make use of this.
$settings->pod = $pod;
}

if ( empty( $ids ) ) {
Expand Down Expand Up @@ -428,6 +430,12 @@ function pods_beaver_uabb_blog_posts( $args ) {
$args['post_type'] = 'any';
remove_filter( 'fl_builder_loop_query_args', 'pods_beaver_uabb_blog_posts' );

// Set post type correctly if a Pod is found.
$pod = pods_v( 'pod', pods_v( 'settings', $args, array() ), null );
if ( $pod ) {
$args['post_type'] = $pod->pod;
}

return $args;
}

Expand Down

0 comments on commit 1da1cc8

Please sign in to comment.