I’m trying to put my own function in a widget but it doesn’t run. I want to use it everywhere within the widget.
If I could see an example,that’d be great.
I’m trying to put my own function in a widget but it doesn’t run. I want to use it everywhere within the widget.
If I could see an example,that’d be great.
You must be logged in to post a comment.
there are a few way to run a function in widgets:
option 1 – ShortCodes
You can create a custom shortcode and run that function by entering the shortcode into a simple text widget:
and then simply add
[my_short_code]
to any text widget to run your function.Option 2 Plugins
You can use one of the many plugins out there that let you run php in a widget like:
Option 3 Custom Widgets
The last way is to write your own widget using the very simple Widgets API