Home › Forums › Calendar Products › Events Calendar PRO › Make New Widget based on List Widget
- This topic has 6 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
July 8, 2015 at 4:44 pm #984929
Ian
ParticipantHello, I have a need to make a second customized template of the List Widget on the pro version.
I’ve already customized the list widget, but I would like to preserve the bundled version of the list widget and create a second one called “Events Carousel.”
I already am clear on bringing the proper templates into my theme to modify the widget template, but am not sure the proper way to create another widget altogether.
If you can’t be specific, please direct me to some docs so that I can do it myself.
Thank you!
July 9, 2015 at 5:48 am #984991Geoff
MemberHi Ian and welcome to the forums! I hope you’ve been enjoying PRO–thanks for upgrading. 🙂
That is a really good question. I think the best best way to go about creating a new widget based on others would be to duplicate the existing templates and rename them altogether. That would allow you to keep all sets of the widgets without them stepping on each other’s toes.
As far as storing the new templates, I believe you could very well put them in the same tribe-events folder as your existing customizations (renamed, of course), or even put them directly in your root theme since they are custom templates.
From there, I think you’ll find this tutorial on using tribe_get_events() handy. That is a nice way to set up the query for events, which you can then use to loop through events posts and style them inside your own markup.
Does that make sense and will this help you get started? Please let me know. 🙂
Cheers!
GeoffJuly 9, 2015 at 6:21 am #985000Ian
ParticipantGeoff,
I’ve done that, but I don’t think what you’ve described goes far enough to actually registering the widget in the widgets selection admin area. It seems like there’s gotta be a few more steps to do that. Thanks for looking into this!
Ian
July 9, 2015 at 6:34 am #985003Geoff
MemberAh, gotcha. Thanks for clarifying!
In that case, you will want to use the WordPress Widget API (WP_Widget class) and perhaps even make this a standalone plugin. The WordPress Codex has the most comprehensive and thorough documentation for registering a new widget, so that is likely the best place to start.
Does that help a little more? Sorry for the initial confusion there, but I certainly do appreciate you clarifying the question for me. 🙂
Cheers!
GeoffJuly 21, 2015 at 12:16 pm #988556Ian
ParticipantI can read the codex, sure. But I want to know how YOU’D do this. You don’t need to write it up for me or make my customizations, just please explain the best route to do this so that when I update your plugin when you update new code, it doesn’t break my theme or the plugin.
Can you please explain how to add this to a child theme. I see the tribe file where the list widget is registered, but I’d like to add some additional options. For example, to output the featured image. I think the best way to do this is to register a new widget that closely resembles the existing ones.
This shouldn’t be too many steps. Thanks for your direction.
I’m a pro subscription holder. THANKS!
July 21, 2015 at 12:45 pm #988583Geoff
MemberHello Ian,
I’m sorry if I’m not coming across clearly in this thread!
The things I’ve mentioned in previous replies are the steps I would recommend for this. In other words, you can register a new widget in the child theme’s functions.php file as described in the Codex. That will prevent the new widget from being unregistered in an update to the parent theme.
From there, you could create duplicates of the calendar plugin widgets and place them as individual plugins in your plugins directly. This is where the majority of custom work will be done, but it will also prevent your customizations from being updated when there are updated to The Events Calendar.
Let me know if there’s anything else I can do to help clarify those steps and I’d be happy to answer as best I can!
Geoff
August 5, 2015 at 7:05 am #993379Support 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 ‘Make New Widget based on List Widget’ is closed to new replies.
