How to add the sidebar widget in a template directly

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #374795
    J. Davis
    Keymaster

    Hi,
    Is it possible to provide me with the code to add the sidebar widget directly into my template?
    I Added a class to my widget in order to display the event name in an inline-block with a min width.
    Is there a way to add my customization to my child theme, or easier, any chance you will add a class the the event name in the widget. See screenshot:
    https://www.evernote.com/l/ASF4u5jJukxDm7fQTsuI0_G3yKWgMGwuJJ4
    Sorry for bombard this forum 🙂
    It would be great if we can display “tomorrow upcoming” events.

    Thank you

    #374801
    J. Davis
    Keymaster

    Hi,

    -First of all make sure you use latest version of plugin.
    -In order to customize output of widget or any other block you can use mptt_render_html filter.
    -Create /mptt/ folder in the root directory of your theme. Then copy widget-upcoming-view.php file to it. It should look like /your_theme_folder/mptt/widget-upcoming-view.php
    -Add code below to functions.php file:

    add_filter('mptt_render_html', 'my_mptt_render_html', 10, 4);
    function my_mptt_render_html($includeFile, $template, $data, $output) {
        if ( $template && $template == 'theme/widget-upcoming-view') {
            return dirname(__FILE__) . '/mptt/widget-upcoming-view.php';
        }
        
        return $includeFile;
    }

    -There might be troubles if we edit source file. We’ll review plugin code and will add more actions and filters.

    Best regards,
    John

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.