Using widgets in the dashboard!

Home Forums Calendar Products Events Calendar PRO Using widgets in the dashboard!

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1150983
    Riccardo
    Participant

    I 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…

    #1151118
    Brook
    Participant

    Howdy 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

    #1151122
    Riccardo
    Participant

    You are my hero!

    Isn’t it lovely: http://prntscr.com/c4zdyq

    #1151555
    Brook
    Participant

    Oh 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
    #1160042
    Support Droid
    Keymaster

    Hey 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

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Using widgets in the dashboard!’ is closed to new replies.