Kyle

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • in reply to: Display search results for only upcoming events #13205
    Kyle
    Member

    Thank you. I look forward to the 2.1 release for a little better overall integration.

    in reply to: Display search results for only upcoming events #13201
    Kyle
    Member

    Joachim, thank you for your response but this still does not work. I put in your code (removing the apostrophes and put in the single quotes), then test it and when you search it just redirects the page to the default events page not to the search page with search results.

    I have created a SANDBOX to test this in to ensure no other code interferes with this. Fresh WordPress install, using the 2011 theme and I still have this issue. You can see and test the site here – http://henriemediabackup.com/carefreelasvegas/

    in reply to: Display search results for only upcoming events #13199
    Kyle
    Member

    No worries Jonah! Thank you for your ideas. I look forward to any additional help!

    in reply to: Display search results for only upcoming events #13197
    Kyle
    Member

    Sorry, that doesn’t work either. It throws the error “Warning: Missing argument 2 for WP_Query::set()”

    function exclude_old_events( $query ) {
    if ( $query->is_search ) {
    $yesterday_before_midnight = date(‘Y-m-d’, mktime(0, 0, 0, date(‘m’),date(‘d’)-1,date(‘Y’))).’ 23:59:59′;
    $meta = array(
    array(
    ‘key’ => ‘_EventStartDate’,
    ‘value’ => $yesterday_before_midnight,
    ‘compare’ => ‘>’
    )
    );
    $query->set( array( ‘meta_query’=>$meta, ‘post_type’=>’tribe_events’ ) );
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_old_events’ );
    ?>

    in reply to: Display search results for only upcoming events #13196
    Kyle
    Member

    Sorry, that doesn’t work either. It throws the error “Warning: Missing argument 2 for WP_Query::set()”

    in reply to: Display search results for only upcoming events #13192
    Kyle
    Member

    Sorry that is test code. Here is what I have –

    function exclude_old_events( $query ) {
    if ( $query->is_search ) {
    $yesterday_before_midnight = date(‘Y-m-d’, mktime(0, 0, 0, date(‘m’),date(‘d’)-1,date(‘Y’))).’ 23:59:59′;
    $meta = array(
    array(
    ‘key’ => ‘_EventStartDate’,
    ‘value’ => $yesterday_before_midnight,
    ‘compare’ => ‘>’
    )
    );
    $query->set( ‘meta_query’, $meta );
    $query->set( ‘post_type’,’tribe_events’ );
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_old_events’ );

    in reply to: Display search results for only upcoming events #13191
    Kyle
    Member

    I have done this and it doesn’t work it just redirects me to the default events page with the upcoming events listed. Sorry for the hassle. Here is what I have –

    function exclude_old_events( $query ) {
    if ( $query->is_search && (‘tribe_events’ == get_post_type()) ) {
    $yesterday_before_midnight = date(‘Y-m-d’, mktime(0, 0, 0, date(‘m’),date(‘d’)-1,date(‘Y’))).’ 23:59:59′;
    $meta = array(
    array(
    ‘key’ => ‘_EventStartDate’,
    ‘value’ => $yesterday_before_midnight,
    ‘compare’ => ‘>’
    )
    );
    $query->set( ‘meta_query’, $meta );
    $query->set( ‘post_type’,’tribe_events’ );
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_old_events’ );

    in reply to: Display search results for only upcoming events #13185
    Kyle
    Member

    Sorry let me be more clear, since I posted my yahoo to soon. If you use this code, only posts that are events or have the meta_key “_EventStartDate” are returned in the results. How do I get this to only apply to event posts instead of all posts?

    in reply to: Display search results for only upcoming events #13184
    Kyle
    Member

    Ok one small problem, this code will only posts/pages with the meta_key “_EventStartDate”. How do I get it to only apply posts that are events?

    in reply to: Display search results for only upcoming events #13182
    Kyle
    Member

    Ok, I got it to work!!! This is the code to make it happen –

    function exclude_old_events( $query ) {
    if ( $query->is_search ) {
    $yesterday_before_midnight = date(‘Y-m-d’, mktime(0, 0, 0, date(‘m’),date(‘d’)-1,date(‘Y’))).’ 23:59:59′;
    $meta = array(
    array(
    ‘key’ => ‘_EventStartDate’,
    ‘value’ => $yesterday_before_midnight,
    ‘compare’ => ‘>’
    )
    );
    $query->set( ‘meta_query’, $meta );
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_old_events’ );

    in reply to: Display search results for only upcoming events #13153
    Kyle
    Member

    I also tried to do it by date with no luck –

    function exclude_old_events( $query ) {
    if ( $query->is_search ) {
    $yesterday_before_midnight = date(“Y-m-d”, mktime(0, 0, 0, date(“m”),date(“d”)-1,date(“Y”))).’ 23:59:59′;
    $meta = array(
    array(
    ‘key’ => ‘_EventStartDate’,
    ‘value’ => $yesterday_before_midnight,
    ‘compare’ => ‘>’
    )
    );
    $query->set( ‘meta_query’, $meta );
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_old_events’ );

    in reply to: Display search results for only upcoming events #13134
    Kyle
    Member

    Jonah, thank you for the response. I added the following with no luck. Did I misunderstand what you posted? Thank you for your help!

    function exclude_old_events( $query ) {
    if ( $query->is_search ) {
    $query->set( ‘eventDisplay’, ‘upcoming’ );
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_old_events’ );

    Nothing happens with this one.

    function exclude_old_events( $query ) {
    if ( $query->is_search ) {
    $query->set(‘eventDisplay’=>’upcoming’);
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_old_events’ );

    I get this error: “Parse error: syntax error, unexpected T_DOUBLE_ARROW”

    Kyle
    Member

    I had to revert back to the 1.3 version due to complaints from my website users. I guess I am going to have to build a sandbox environment to work out all of the bugs. You can close the case if you would like.

    Kyle
    Member

    I also tried this fix just in case (no luck) – https://theeventscalendar.com/patch-for-the-events-calendar-2-0-2-date-bug/

    Kyle
    Member

    Rob, thank your for the quick response. I am running both versions as 2.0.2. What is really bizarre is if I change the theme to the TwentyEleven 1.3 theme the date shows up correctly. I have checked my current theme and see no code in the page that is any different than that theme. Any ideas what could possibly make this happen? I am using the default code for the plug-in so all of the calls and functions are standard – no mods whatsoever. So it doesn’t make sense to me. Any help would be appreciated! Thanks again!

Viewing 15 posts - 1 through 15 (of 16 total)