Home › Forums › Calendar Products › Events Calendar PRO › Using widgets in the dashboard!
- This topic has 5 replies, 4 voices, and was last updated 9 years, 8 months ago by
Riccardo.
-
AuthorPosts
-
August 12, 2016 at 9:31 am #1150983
Riccardo
ParticipantI know it may sound weird, however I am attempting to use the widgets in the metaboxes of the welcome screen in the dashboard.
To achieve this it is advised to call the functions behind the shortcodes (see here)
I see that in widget_wrappers.php the shortcodes are added:
/** * Registers shortcodes handlers for each of the widget wrappers. */ class Tribe__Events__Pro__Shortcodes__Widget_Wrappers { public function __construct() { add_shortcode( 'tribe_mini_calendar', array( $this, 'mini_calendar' ) ); add_shortcode( 'tribe_events_list', array( $this, 'events_list' ) ); add_shortcode( 'tribe_featured_venue', array( $this, 'featured_venue' ) ); add_shortcode( 'tribe_event_countdown', array( $this, 'event_countdown' ) ); add_shortcode( 'tribe_this_week', array( $this, 'this_week' ) ); }But I don’t know what is the correct function to be called to invoke the widget…
August 12, 2016 at 12:44 pm #1151118Brook
ParticipantHowdy Ricardo,
I would love to help you with this.
The first thing you would want to do is grab the reference to that class. This can be done like so:
$widget_wrappers = Tribe__Events__Pro__Main::instance()->widget_wrappers; $args = array(); $widget_wrappers->mini_calendar( $args ); $widget_wrappers->events_list( $args ); $widget_wrappers->featured_venue( $args ); $widget_wrappers->event_countdown( $args ); $widget_wrappers->this_week( $args );
And that’s you could show each of those widgets. Obviously you probably don’t want to see all of the widgets, so feel free to delete any that are unused. You will need to populate the $args var with the arguments you’d normally pass to the shortcode.
And finally, while that will render the HTML for those widgets it might not include all the necessary styling and JavaScript. You might need to manually add some scripts and CSS, you might event to write some of your own, to get them styled right and functioning correctly in WP Admin. Since they are only designed to work on the front end this could be a problem — I don’t know, I’ve never tested them back there. Hopefully not.
Does that all make sense? Will that work for you? Please let me know.
Cheers!
– Brook
August 12, 2016 at 1:07 pm #1151122Riccardo
ParticipantYou are my hero!
Isn’t it lovely: http://prntscr.com/c4zdyq
August 14, 2016 at 11:21 pm #1151555Brook
ParticipantOh beautiful! I am glad that worked. It sounds like you did not need any extra styles, which makes me happy. Thanks for getting back!
- Brook
September 5, 2016 at 9:35 am #1160042Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Using widgets in the dashboard!’ is closed to new replies.
