Thank you Shane! You are the man! I really appreciate you taking the time to help me out! My issue is resolved now. Thank you!
Sorry, Shane. I was just checking the site on mobile, and is there anyway to show 4 new custom post at a time instead of 6 on the web? The page keeps moving and it might annoy some people. Or do I have to create a new View only for mobile?
Sorry Shane for sending so many messages. I just wanted to clarify something. If I add the height CSS code that you sent, it affects mobile and it does elements overlap.
So I was wondering if there is a way to use the same View but have different layout on desktop than mobile. For example, on desktop and tablet, keep the same 6 custom post per page, but on mobile have 2 instead.
Or do I need to make one View for desktop and another for mobile?
I'm so annoying, I'm so sorry... but how do I make the view_id into an array so I can include another view?
add_filter( 'wpv_filter_query', 'query_recent_posts',99,3 );
function query_recent_posts( $query_args,$view_settings,$view_id ) {
if ( $view_id == 4298 ) {
$query_args['date_query'] = array(
'column' => 'post_date_gmt',
'after' => '10 days ago',
);
}
return $query_args;
}
Shane
Supporter
Idiomas:
Inglés (English )
Zona horaria:
America/Jamaica (GMT-05:00)
Hi Felipe,
No worries i'm here to help.
In order for you to have a different number of items on mobiles you will need to create a different view to do this. This view should only load on mobiles.
I believe you are using elementor so they may have a setting in their layout options to hide an area on mobile and show only an area on mobiles.
For this function below you will add the array like this.
add_filter( 'wpv_filter_query', 'query_recent_posts',99,3 );
function query_recent_posts( $query_args,$view_settings,$view_id ) {
$ids = array(4298,11111,22222);
if ( in_array($view_id,$ids) ) {
$query_args['date_query'] = array(
'column' => 'post_date_gmt',
'after' => '10 days ago',
);
}
return $query_args;
}
Please let me know if this helps.
Thanks,
Shane
Yes it worked great! I kind of figured I had to create a new View for mobile so I did just that. Added your code and pah! success! You are awesome! My issue is resolved now. Thank you!