0

I have a code that work fine for Active Events Page, Upcoming Event Page & Past Event Page with a event_start_date later than today.

What I want is?

A : To show Active, Upcoming, Past event post list with pagination on there page between dates, For example :

  1. If today is 11 May 2018, and an event with the dates 9 to 25 May then this listing show on Active Event page.
  2. If today is 11 May 2018, and an event with the dates 20 to 30 May or June/July then this listing show on Upcoming Event page,
  3. If today is 11 May 2018, and an event with the dates 5 to 8 March or April/May then this listing show on Past Event page.

B : I also want Featured listing too, For example :

if i have 10 or 20 events posts on Active event page and i want to make 5th/8th/15th no post to be featured listing, then if i right tick to my Featured Listing (meta_key: event_featured, meta_value : yes) then those post (5/8/15) display list on top, and after that other post ie: 1,2,3,4,6,7,9 - - - - will display.

C: i also want to display those 5/8/15 no post in different color with other post.

D: i also want to display those 5/8/15 post order by date. For example :

if 5th no. event post start date = 6 May , 8th no. event post start date = 11 May, and 15th no event start date = 9 May then Event listing display will be : 5th/15th/8th after that other event post list display order by date.

now final active event list will be like : 5/15/8/1/2/3/6/7/4/9/10 - - - - -

E : i also want this type of pagination, For example :

if i have 20 active event post listing and 5/8/15 no. post is featured listed and i want to show 6 post per page then i want pagination like this :

1 page listing : 5/8/15/1/2/3

2 page listing : 4/6/7/9/10/11

3 page listing : 12/13/14/16/17/18

over all i don't want to repeat featured listing on pagination.

Problem : I don't want to use sticky option, because if i active sticky on any active event post then it is showing to upcoming and past event listing too and its also appear on pagination next pages too.

here is my simple code but its not fulfill my requirements :

<?php 
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
 $today = date('Y-m-d', strtotime('-1 hours'));
 $args = array(
 'post_type' => 'post', 
 'posts_per_page' => 1,  
 'paged' => $paged,
 'orderby' => 'meta_value',
 'order' => 'ASC',
 'meta_query'=>array(
        'relation'=>'AND',
        array(
            'key' => 'event_start_date',
            'value' => $today,
            'compare' => '<=',
            'type' => 'CHAR'
        ),
        array(
            'key' => 'event_end_date',
            'value' => $today,
            'compare' => '>=',
            'type' => 'CHAR'
        )
    )
);

can any one help me to make perfect code for my page requirements?

thanks in advance, and sorry for my bad English..

  • still waiting for solution :( – gul rathod May 11 '18 at 12:05
  • any one can help me plz? – gul rathod Jun 6 '18 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.