Forum Replies Created
-
AuthorPosts
-
JamesParticipant
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” } }
JamesParticipantThank 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.
JamesParticipantFirst: 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=2013I’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!
JamesParticipantThat was very helpful because now uploading the function doesn’t break my whole site, but it also doesn’t do anything when I define the year in the URL.
In my functions.php file…
// Events archive
global $searchyear;
$searchyear = NULL;
add_filter (‘parse_query’,’fwa_query_post_year’);
function fwa_query_post_year ($query) {
$searchyear = $_GET[“searchyear”];
$newstartdate = $searchyear.’-01-01 00:00:00′;
$newenddate = $searchyear.’-12-31 23:59:59′;
//$eventposttype = $query[‘post_type’];
if (!empty($searchyear) && tribe_is_event_query()) {
$query->set(‘_EventStartDate’,$newstartdate);
$query->set(‘_EventEndDate’,$newenddate);
}
return $query;
}JamesParticipantThank you. I understand that you’re limited in how you can help.
Here’s what I’ve tried… any help is appreciated:add_filter (‘parse_query’,’fwa_query_post_year’,”,1);
function fwa_query_post_year ($searchyear) {
if (!empty($searchyear) && $query[‘post_type’]==’tribe_events’) {
$query->set(‘start_date’,$searchyear);
$query->set(‘end_date’,$searchyear);
}
return $query;
}I also tried _EventStartDate and _EventEndDate
I think there’s something with the conditional, but when I remove the second half, it breaks the whole site.
Any help is GREATLY appreciated.
JamesParticipantI’ll look at it more in the morning, but — the thing is — it was working. I mean, I tested it, I showed it to the client, it all worked just fine. Maybe because there were fewer events, so it didn’t have to go beyond the first page or something? I dunno. I’ll see what I can help…
And if you reference the page without the string and then click “previous events” enough times, you’ll find the 2013 events.
JamesParticipantWell, take a look at this:
http://fwatest.org/event-archive/past-events/?searchyear=2013
There are several events with 2013 as the event year. For some reason, it doesn’t display them.JamesParticipantIt’s working again. There’s another issue since this update, but I’m starting a new thread.
JamesParticipantDo you have an ETA for this? My client is getting frustrated (and I don’t blame them).
JamesParticipantIt’s OK. I actually removed the categories and am using other methods.
Thank you.
JamesParticipantWorked great.
There were a few changes, which I’ll share here in case someone else wants/needs to use it:add_filter( 'tribe_event_featured_image', 'featured_event_img_placeholder' ); function featured_event_img_placeholder( $html ) { if ( empty( $html ) ) { $html = '<div class="default-calendar-icon tribe-events-event-image"><a href="'. tribe_get_event_link() .'" title="'. get_the_title( $post_id ) .'"><img src="http://fwatest.org/content/uploads/2014/03/Calendar-ICON.jpg" title="'. get_the_title( $post_id ) .'" /></a></div>'; } return $html; }
THANK YOU!!!
JamesParticipantI think it only displays future posts? Not past?
JamesParticipantI have used it to insert a default image when the event doesn’t have a featured image set.
I also don’t want the big year divider to show when an event is in a prior year. At the very least, I need to be able to MOVE it (for some reason, the default is
month header — APRIL 2012
year divider — 2012
I can swap these around in the general.php file, but then if I update, they’ll be lost.JamesParticipantNEVERMIND. I forgot the echo. 🙂
JamesParticipantYes, but I have tried that (and everything else I can think of), and it’s not working. Here’s my code — I realize I forgot to mark it as code again, so let’s see if this works….
<a class="button" href="<?php tribe_get_event_website_url(); ?>" target="_blank">Register Now!</a>
-
AuthorPosts