Skip Navigation

[Resuelto] New custom post from the last 7 days

This support ticket is created hace 5 años. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Etiquetado: 

Este tema contiene 35 respuestas, tiene 2 mensajes.

Última actualización por FelipeP5703 hace 5 años.

Asistido por: Shane.

Autor
Mensajes
#1378993

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!

#1379009

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?

#1379011

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?

#1379019

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;
}
#1379063

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

#1379071

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!