WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Template for Events Manager widget? (7 posts)

  1. jbx
    Member
    Posted 1 year ago #

    This is more of a feature request rather than a support request (unless it is already there and I didn't realise).

    I suggest that the Events Manager widget is also controlled through a fully customizable template. The current way it works only allows you to specify an inline template (through wordpress admin) for one event in the widget which is repeated for how many events you want to display. However you cannot control the overall widget.

    For example I wanted to move the 'all events' link to the top of the widget (rather than the bottom) and I had to modify the core widget() function in /events-manager/widgets/em-events.php which means it will get overwritten with the next upgrade.

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 1 year ago #

    for all events link, you can try to use some css styling using your theme style.css and for the formats try list item format.

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    For widgets, there's such little code involved I'd advise copying our widget (widgets/em-events.php) and just creating your own in your theme's functions.php file.

    I'd hesitate to add yet another template in this case.

  4. jbx
    Member
    Posted 1 year ago #

    Instead of polluting my functions.php (which is already becoming quite big) can I put it somewhere else under my theme's folder in a separate file named em-events.php?

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    sure, e.g. if you include that file from your functions.php file it'll work.

    other ways - http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/

  6. jbx
    Member
    Posted 1 year ago #

    I tried to do as you say and put my modified em-events.php in mytheme/plugins/events-manager/widgets/

    I then added the following to the top of my functions.php:
    require_once("plugins/events-manager/widgets/em-events.php");

    However I got the following error, obviously because there is yours too.

    Fatal error: Cannot redeclare class EM_Widget in /httpdocs/wordpress/wp-content/themes/mytheme/plugins/events-manager/widgets/em-events.php on line 191

    What is the right way to override the widget without creating the conflict and allowing for automatic updates?

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    This is because you're including a file with a class that is already declared. Just change EM_Widget to something unique in your class and it'll work.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic