Home › Forums › Ticket Products › Event Tickets Plus › Accessing Event Calendar variables in pages other than Event Calendar pages
- This topic has 9 replies, 3 voices, and was last updated 9 years, 6 months ago by
Josh.
-
AuthorPosts
-
October 9, 2016 at 4:49 pm #1174352
Jeff
ParticipantI have WooTabs in my WooCommerce store and I need to place specific events in a tab. I can either put php embedded into a tab to display dates with my formatting (So shortcodes won’t cut it).
Or I can make specific php pages that create the list of events and then use iframe tags to insert that page into the tab
I’ve modified your templates a lot so I know how to work with the variables. I’m not sure how to get all the <script> tags and anything else that is needed to access your variables within a blank php page. Does this make sense? I’m not sure where to start, but I’m hoping you can point me to a few pages on your site that might discuss this.
October 10, 2016 at 12:01 pm #1174594Josh
ParticipantHey Jeff,
Thanks for reaching out to us!
I’m not sure I follow exactly what you’re looking for here. Are you wanting to generate of events to use in your WooTabs? Or are you wanting to completely recreate the event views within these tabs?
However, I do see you mentioned not being able to use shortcodes there. However, if the shortcode was a possible solution, you can call those within PHP using the format:
<?php echo do_shortcode('[my_shortcode]'); ?>Let me know if this helps.
Thanks!
October 10, 2016 at 5:19 pm #1174711Jeff
ParticipantYes, completely recreate a simple list of events almost exactly as you see here:
http://a82.dd7.myftpupload.com/events
but have them within the tab of certain products. This might seem kind of dumb, but I want certain events in one tab and other events in another tab. Doctors will only pay for the events listed in the first tab and they’ll pay other people for the events listed in the second tab.I redid most of the code for the page I’ve given you the link to. I know it’s not what most people would want, but this works great for our situation. I wrote that code within an event calendar template which gets added to a full WordPress page with all the <script> tags that allow access the event calendar variables. When I compare the code for the events page given above I see a bunch of <script> tags for the event calendar plugin, but when I look in my store, only a few exist.
So I’m wondering if you’ve ran into this situation before. Where people wanted access to all the event calendar variables on pages other than your predefined pages. I can add shortcodes in the tabs, but not sure if your shortcodes will give me what I want.
I could also add script tags into headers using another plugin that allows anything to be added anywhere and with this plugin I could insert php into the tab using shortcodes as well. I haven’t tried this because I thought you might have a better idea.
Does this clarify things better?
October 10, 2016 at 5:32 pm #1174716Jeff
ParticipantOr I could always make a stand alone php page with the short list of events that I’m talking about (dynamically generated however) and using iframe they could be put right into the tab with little trouble. Thing is what should that php look like without trying to just copy a wordpress event page with all the extra html in it that probably isn’t needed. Just need the basic layout I guess.
October 11, 2016 at 10:29 am #1175062Josh
ParticipantHey Jeff,
Thanks for following up!
The associated scripts you’re seeing for the calendar are for the interactions with performing the pagination, search, tooltips, etc. They aren’t used for directly outputting the content for the calendar (except for the tooltips). So, I don’t think you need additional ones for what you’re trying to accomplish here.
If each tab has it’s own list of events, it would probably be best to use our tribe_get_events function to create loops and outputting the needed information within those loops the same way you would on any other event loop.
Alternatively, using the shortcode in the way described above should also work here as well.
Let me know if this helps.
Thanks!
October 11, 2016 at 7:11 pm #1175198Jeff
ParticipantWow, you’re right. I was able to paste this code into the tab indirectly which you can see here:
http://a82.dd7.myftpupload.com/product/basic-seminar-4#tab-description
Then click on the tab “RSVP Your Seminar Choice”
The code is below.So now in the loop I need to identify if the event has RSVP functionality added or not. This way I can separate events into two separate lists. The seminars that a person can RSVP to and the seminars where no RSVP tickets were set up in the event. I looked for a function that identified that, but didn’t have much luck. No need to look at the code below since it works. But I need to identify this distinction between the events.
<div id=”schedule”>
<table border=”0″ cellpadding=”3″>
<tbody>
<?php
echo “hello”;
global $post; // Ensure the global $post variable is in scope
$row = 0;
$events = tribe_get_events( array(
‘start_date’ => date( ‘2016-01-01 12:00:00’ ),
‘end_date’ => date( ‘2026-12-31 12:00:00’ ),
‘eventDisplay’ => ‘custom’,
‘posts_per_page’ => -1
));
$todaysDate = date(“Y-m-d H:i:s”);
if ( empty( $events ) ) {
echo ‘Sorry, nothing found.’;
}// Or we may have some to show
else foreach( $events as $post ) {
// setup_postdata( $post );
//echo get_the_title( $post ) . ‘–Jeff’.tribe_get_start_date().'<br/>’;
//echo “*”.tribe_get_start_date(null,false, “Y-m-d H:i:s”);
//$eventDate=get_post_meta($id,’_EventStartDate’, “Y-m-d H:i:s”);
//if ($eventDate >= $todayDate) {
//echo “*”;
//}
if ($row%2 == 0) {
echo “<tr class=\”opposite\”>”.PHP_EOL;
} else {
echo “<tr class=\”normal\”>”.PHP_EOL;
}
$eventDate = tribe_get_start_date(null,true,”Y-m-d H:i:s”);
//echo $todaysDate.” “.$eventDate;
$state = tribe_get_state();
if(empty($state)) {
$locationStringJeff = tribe_get_city().’, ‘.tribe_get_country();
} else {
if (tribe_get_country()==’United States’) {
$locationStringJeff = tribe_get_city().’, ‘.tribe_get_state().’, USA’;
} else {
$locationStringJeff = tribe_get_city().’, ‘.tribe_get_state().’, ‘.tribe_get_country();
}
}
$position = strpos(get_the_title(), “–”);
$title_text = substr(get_the_title(), 0, $position);if ($eventDate < $todaysDate) { ?>
<td class=”date”><?php echo tribe_get_start_date(null,false,’M j’).’-‘.tribe_get_end_date(null,false, ‘j, Y’); ?></td><td class=”location”><?php echo $locationStringJeff ?></td><td class=”level”><?php echo $title_text;?></td>
<?php
} else { ?>
<td class=”date”>” title=”<?php the_title_attribute() ?>” rel=”bookmark”><?php echo tribe_get_start_date(null,false,’M j’).’-‘.tribe_get_end_date(null,false, ‘j, Y’); ?></td><td class=”location”><?php echo $locationStringJeff ?></td><td class=”level”><?php echo $title_text;?></td>
<?php
}
echo “</tr>”. PHP_EOL;
$row++;
}
?>
</tbody>
</table>
</div>October 13, 2016 at 7:21 am #1175899Josh
ParticipantHey Jeff,
Awesome! I’m glad you were able to get that working.
You can use the “tribe_events_has_tickets” conditional to check whether an event has tickets or RSVPs associated with it.
Let me know if this helps.
Thanks!
October 13, 2016 at 8:59 am #1175958Jeff
ParticipantWonderful!!! Thank you very much.
October 14, 2016 at 5:11 am #1176474Josh
ParticipantHey Jeff,
No problem, happy to help!
I’ll go ahead and close this thread for now. If you have any further questions, please don’t hesitate to open a new one.
Thanks!
-
AuthorPosts
- The topic ‘Accessing Event Calendar variables in pages other than Event Calendar pages’ is closed to new replies.
