M
M
Maxim Maximov2018-10-01 12:23:02
WordPress
Maxim Maximov, 2018-10-01 12:23:02

Wordpress, remove record from output?

Now the entries are displayed like this:

<?php global $post;
$args = array( 'posts_per_page' => 10,'post_type' => 'education', 'meta_key'  => 'sm-esno','meta_value'  =>'1', 'order' => 'ASC', 'orderby' => 'date meta_value' );
$myposts = get_posts( $args );
foreach( $myposts as $post ){ setup_postdata($post);
?>

The entry is displayed if the custom field sm-esnohas a value 1(this should remain)
There are custom fields:
sm-data- start date and
sm-time- start time.
It is necessary to somehow display so that the records:
1) Sorted by these fields, i.e. first, the time and date of which are closer to the actual ones were shown
(for example, the date and time of the 1st event = 01.10.2018 10:00, and the date and time of the beginning of the second = 01.10.2018 14:00,
so we first display the first and then the second)
2) Remove entry from the output if the time is now (MSK) <= (less than or equal to) 3 hours before the start of the 1st event,
and so on, as there are 3 hours left before the 2nd, then delete it, etc.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question