Home › Forums › Calendar Products › Events Calendar PRO › customized event list widget- how to display post_content?
- This topic has 3 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
October 15, 2013 at 9:10 pm #71201
ironandsteel
ParticipantI am trying to cobble together a “next event” widget which will display pretty much exactly what you see when you are viewing a single event. I have managed to duplicate the event list widget, and give my new one a different name, and get it to appear in my widgets, and it works.
Now- I am trying to figure out how to get it to display the details of the event, which is in the event field “post_content” (I looked in phpmyadmin at the database to see what the proper field is).In the list-widget.php file (which is what you override to customize the list widget) there are functions called like tribe_get_phone(),tribe_get_organizer(), tribe_events_event_schedule_details(), and I have found those funcs in the-events-calendar/public/template-tags/general.php. But I don’t see anything that read the event content.
What I have done so far is this:
– I created plugins/events-calendar-pro/lib/widget-show-next-event.class.php (a copy of widget-advanced-list.class.php)
– I created plugins/events-calendar-pro/admin-views/widget-admin-next-event.php (a copy of widget-admin-advanced-list.php)
– In the main events-calendar-pro.php file, I pull in my new class, and register the widget:
public function pro_widgets_init() {
…
require_once( ‘lib/widget-show-next-event.class.php’ ); //my new class
register_widget( ‘TribeNextEventWidget’ ); //my new widget
}
– I created {my theme}/tribe-events/widgets/next-event-widget.php (a copy of list-widget.php)
– I attempted to cause my widget-show-next-event.class.php file to use my new next-event-widget.php by referring to “next-event-widget”, to no avail:
function widget( $args, $instance ) {
// Use parent’s output function with the premium template.
self::$params = $instance;
return parent::widget_output( $args, $instance, ‘next-event-widget’, ‘widgets’, ‘pro’, TribeEventsPro::instance()->pluginPath );
}So, 2 issues:
1. How can I get my custom template file (next-event-widget.php) to be used? I assume that putting it in my theme folder is the right thing to do, as you describe in your help doc on theming.
2. How do I display the event details, and pretty much all the other fields. It can be hard-coded- it doesn’t need to be customizable like the event list widgetClearly, I’m off in the weeds here, and this is brute force, but I gotta get it going. Thanks!
October 16, 2013 at 1:53 pm #71356Barry
MemberHi! Fantastic to see someone building a custom widget in this way π
In the list-widget.php file (which is what you override to customize the list widget) there are functions called like tribe_get_phone(),tribe_get_organizer(), tribe_events_event_schedule_details(), and I have found those funcs in the-events-calendar/public/template-tags/general.php. But I donβt see anything that read the event content.
What you’ll probably notice in the default list view widget is that the title is rendered using WordPress’s standard the_title() template tag – and so by a similar token you should also be able to use the_content() or the_excerpt() here.
How can I get my custom template file (next-event-widget.php) to be used?
If you override the
tribe_get_template_part( ‘widgets/list-widget’ ) call with your own code to load your own template π You were definitely on the right track (by passing a different template name to the parent method) however I think in this case the method signature might be a little misleading.
Hope that helps!
October 16, 2013 at 1:54 pm #71357Barry
MemberTo add, because this is indeed customization territory I’ll go ahead and close this thread (since it is outwith what we can support) – but we do wish you luck π
July 7, 2015 at 6:29 am #981443Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘customized event list widget- how to display post_content?’ is closed to new replies.
