Appearance
Are you an LLM? You can read better optimized documentation at /kinsey/wp/tips-tricks/changing-post-type-in-dynamic-widgets.md for this page in Markdown format
Changing Post Type in Dynamic Widgets ​
If you want to display posts other than the default arts_portfolio_item or arts_service in Elementor dynamic widgets, you can use the following filters to modify the query used to fetch the posts.
php
// Portfolio Fullscreen Horizontal Scrolling Widget
add_filter( 'arts/elementor/kinsey_widget_portfolio_fullscreen_horizontal_scrolling/query_args' );
// Portfolio Fullscreen Slider Backgrounds 1 Widget
add_filter( 'arts/elementor/kinsey_widget_portfolio_fullscreen_slider_backgrounds_1/query_args' );
// Portfolio Fullscreen Slider Backgrounds 2 Widget
add_filter( 'arts/elementor/kinsey_widget_portfolio_fullscreen_slider_backgrounds_2/query_args' );
// Portfolio Fullscreen Slider Images 1 Widget
add_filter( 'arts/elementor/kinsey_widget_portfolio_fullscreen_slider_images_1/query_args' );
// Portfolio Halfscreen Slider Backgrounds Widget
add_filter( 'arts/elementor/kinsey_widget_portfolio_halfscreen_slider_backgrounds/query_args' );
// Portfolio List Backgrounds Widget
add_filter( 'arts/elementor/kinsey_widget_portfolio_list_backgrounds/query_args' );
// Portfolio Masonry Grid
add_filter( 'arts/elementor/kinsey_widget_portfolio_masonry_grid/query_args' );
// Portfolio Slider Cards Backgrounds
add_filter( 'arts/elementor/kinsey_widget_portfolio_slider_cards_backgrounds/query_args' );
// Posts List Backgrounds
add_filter( 'arts/elementor/kinsey_widget_posts_list_backgrounds/query_args' );
// Posts Masonry Grid
add_filter( 'arts/elementor/kinsey_widget_posts_masonry_grid/query_args' );
// Services Grid
add_filter( 'arts/elementor/kinsey_widget_services_grid/query_args' );You can use the code from the examples below in the wp-content/themes/kinsey-child/functions.php file of the Kinsey child theme.
Example 1 ​
Make the Elementor Portfolio Fullscreen Slider Backgrounds 1 widget always display pages in the slider instead of portfolio items:
php
add_filter( 'arts/elementor/kinsey_widget_portfolio_fullscreen_slider_backgrounds_1/query_args', 'custom_kinsey_filter_1' );
function custom_kinsey_filter_1( $args ) {
$args['post_type'] = 'page'; // page, post, arts_service, arts_portfolio_item, etc...
return $args;
}Example 2 ​
Make the Elementor Portfolio Halfscreen Slider Backgrounds widget display services in the slider instead of portfolio items only on the post with ID 16:
php
add_filter( 'arts/elementor/kinsey_widget_portfolio_halfscreen_slider_backgrounds/query_args', 'custom_kinsey_filter_2' );
function custom_kinsey_filter_2( $args ) {
global $post;
if ( $post->ID === 16 ) {
$args['post_type'] = 'arts_service'; // page, post, arts_service, arts_portfolio_item, etc...
}
return $args;
}