Posted: November 16, 2012 at 2:04 pm
I cannot figure out how to make changes to the Calendar widget without making said changes to the core plugin files, which will of course be overwritten when the plugin is updated. In espresso-calendar.php – how do I modify the Espresso_Calendar_Widget class? I have tried copying/pasting some code into my custom_functions.php file I change the names of things where necessary to avoid “You cannot redeclare X funciton/class” errors, but still I can’t get it to create a new custom widget without other errors. When I go to the widgets page with WP_DEBUG turned on, I get the following errors:
In addition, a blank draggable widget appears on the Widgets page. Any ideas on how to edit the Calendar widget? Really what I’m after is using my own espresso-calendar-widget.php and removing the if (!is_page($calendar_page)) conditional. I have successfully made these, but I just can’t figure out how to make them in the custom_functions.php file. | |
Hi there, In order to copy a function into the custom_functions.php file so it will override an existing function, the function has to be pluggable. This means the function will be wrapped in an In the case of the calendar widget, the main calendar widget function isn’t pluggable. What you could do as a work around would be to create a new plugin using your modified code, and prefix the function names so this new plugin doesn’t conflict with the existing one. | |
I noticed it wasn’t pluggable, which is why I’m having problems. Like I said, I tried making my own functions by changing the names (prefixing) but it didn’t work. It seemed like there was just something else that needed to be prefixed that I couldn’t find. | |
The support post ‘Custom functions for Calendar plugin?’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.