Please please please

Home Forums Calendar Products Events Calendar PRO Please please please

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #227846
    James
    Participant

    I know that you can’t support this, really. But maybe just a hint? You’ve given me so many, but if you can’t support this directly (which I totally understand), then maybe you can point me in a direction or offer a resource (even if it’s a paid one)? I totally appreciate it.

    THE GOAL: to pass a value to $searchyear from the URL and modify the query to return events that fall in the designated year. Thank you!!!


    global $searchyear;

    add_filter ('parse_query','fwa_query_post_year',10,1);

    function fwa_query_post_year ($query) {
    $searchyear = NULL;
    $searchyear = $_GET["searchyear"];

    $newstartdate = $searchyear.'-01-01 00:00:01';
    $newenddate = $searchyear.'-12-31 23:59:59';

    if ( $searchyear != NULL && tribe_is_event() ) {
    $query->set( 'start_date', $newstartdate);
    $query->set( 'end_date', $newenddate);
    }
    return $query;
    }

    #229940
    Casey D
    Member

    Hi jamesdonegan, I’ll do what I can!

    How does this code interact with the user and what is it displaying right now? It seems really close to me. I could trouble shoot a bit better if you gave more info. Typing it out might help you think about it too.

    If you’d like a list of paid freelancers we’ve worked with in the past, feel free to email us at [email protected]

    Cheers!

    – Casey Driscoll

    #229988
    James
    Participant

    First: THANK YOU.

    What happens is NOTHING. Seems to have no effect. I have tested it by adding some echo statements to be sure the if was even running (it is). But literally it has no effect on what displays.

    What will happen is that I’ve created some buttons for the sidebar that will add the “searchyear” call to the URL when clicked.

    What it’s supposed to do is get the value of $searchyear, format it correctly, then redefine the start and end date parameters of the query. I can’t tell you how many times I’ve read and re-read the TribeEventsQuery code. I’ve tried numerous things — including (but not limited to):

    • $query_>set(‘ _EventEndDate’,$newenddate); (etc)
    • Parsing just the year from the event’s End/Start date and then returning a boolean if it falls within the searchyear
    • $query .= " AND WHERE '_EventStartDate' >= ".$newstartdate." AND WHERE '_EventEndDate' <= ".$newenddate." ";

    When I try various things, it either returns a blank page or it affects nothing at all.

    You can see if you look here:
    http://fwa.org/event-archive/past/?searchyear=2013

    I’m very much an “intermediate” PHP guy. I can usually figure out what’s going on and make edits/write filters after a little trial and error, but this has really stumped me.

    Thank you for whatever help you can offer. If it turns out I need to contact a third party freelancer, I will email for the list. Thank you!

    #367147
    Casey D
    Member

    Whoa, sorry for the massive delay on my response! I put this in my ‘when I have time’ pile and I never got around to it!

    Can I get an update on this and then I can take a look!

    Sorry again!

    – Casey Driscoll

    #413215
    James
    Participant

    Thank you so much. There’s not much update. I’ve just reached out to a couple of developers — from your list and NOT from your list — and so far, no one is much help. I haven’t heard back from everyone, though. Any further guidance you can offer is greatly appreciated. I did try doing a var_dump on $query before I returned it, and it didn’t appear the $query[‘start_date’] was defined at all. Seems odd.

    #413226
    James
    Participant

    This was the result of the “dump”…

    object(WP_Query)#323 (44) { [“query_vars”]=> &array(52) { [“post_type”]=> string(12) “tribe_events” [“eventDisplay”]=> string(4) “past” [“error”]=> string(0) “” [“m”]=> string(0) “” [“p”]=> int(0) [“post_parent”]=> string(0) “” [“subpost”]=> string(0) “” [“subpost_id”]=> string(0) “” [“attachment”]=> string(0) “” [“attachment_id”]=> int(0) [“name”]=> string(0) “” [“static”]=> string(0) “” [“pagename”]=> string(0) “” [“page_id”]=> int(0) [“second”]=> string(0) “” [“minute”]=> string(0) “” [“hour”]=> string(0) “” [“day”]=> int(0) [“monthnum”]=> int(0) [“year”]=> int(0) [“w”]=> int(0) [“category_name”]=> string(0) “” [“tag”]=> string(0) “” [“cat”]=> string(0) “” [“tag_id”]=> string(0) “” [“author”]=> string(0) “” [“author_name”]=> string(0) “” [“feed”]=> string(0) “” [“tb”]=> string(0) “” [“paged”]=> int(0) [“comments_popup”]=> string(0) “” [“meta_key”]=> string(0) “” [“meta_value”]=> string(0) “” [“preview”]=> string(0) “” [“s”]=> string(0) “” [“sentence”]=> string(0) “” [“fields”]=> string(0) “” [“menu_order”]=> string(0) “” [“category__in”]=> array(0) { } [“category__not_in”]=> array(0) { } [“category__and”]=> array(0) { } [“post__in”]=> array(0) { } [“post__not_in”]=> array(0) { } [“tag__in”]=> array(0) { } [“tag__not_in”]=> array(0) { } [“tag__and”]=> array(0) { } [“tag_slug__in”]=> array(0) { } [“tag_slug__and”]=> array(0) { } [“post_parent__in”]=> array(0) { } [“post_parent__not_in”]=> array(0) { } [“author__in”]=> array(0) { } [“author__not_in”]=> array(0) { } } [“tax_query”]=> object(WP_Tax_Query)#75 (2) { [“queries”]=> array(0) { } [“relation”]=> string(3) “AND” } [“meta_query”]=> bool(false) [“date_query”]=> bool(false) [“post_count”]=> int(0) [“current_post”]=> int(-1) [“in_the_loop”]=> bool(false) [“comment_count”]=> int(0) [“current_comment”]=> int(-1) [“found_posts”]=> int(0) [“max_num_pages”]=> int(0) [“max_num_comment_pages”]=> int(0) [“is_single”]=> bool(false) [“is_preview”]=> bool(false) [“is_page”]=> bool(false) [“is_archive”]=> bool(false) [“is_date”]=> bool(false) [“is_year”]=> bool(false) [“is_month”]=> bool(false) [“is_day”]=> bool(false) [“is_time”]=> bool(false) [“is_author”]=> bool(false) [“is_category”]=> bool(false) [“is_tag”]=> bool(false) [“is_tax”]=> bool(false) [“is_search”]=> bool(false) [“is_feed”]=> bool(false) [“is_comment_feed”]=> bool(false) [“is_trackback”]=> bool(false) [“is_home”]=> bool(true) [“is_404”]=> bool(false) [“is_comments_popup”]=> bool(false) [“is_paged”]=> bool(false) [“is_admin”]=> bool(false) [“is_attachment”]=> bool(false) [“is_singular”]=> bool(false) [“is_robots”]=> bool(false) [“is_posts_page”]=> bool(false) [“is_post_type_archive”]=> bool(false) [“query_vars_hash”]=> string(32) “7626071ce68466e8c2862d286f99b12b” [“query_vars_changed”]=> bool(false) [“thumbnails_cached”]=> bool(false) [“stopwords”:”WP_Query”:private]=> NULL [“query”]=> array(2) { [“post_type”]=> string(12) “tribe_events” [“eventDisplay”]=> string(4) “past” } }

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Please please please’ is closed to new replies.