How can a widget which of which only one instance can be used?
Tell me more
×
WordPress Answers is a question and answer site for
WordPress developers and administrators. It's 100% free, no registration required.
|
Simple way would be to set some global variable on first widget run and check for it. Output nothing or informational message if it is already set. Proper way would probably be to work with interface and remove widget from available when you add it to sidebar, but that is way out of my league. |
|||||
|
|
I put together the following code based on @Philip's answer. Seems to work for me. Any suggestions are welcome!
|
|||
|
|
|
you can create widgets that can activated once with the old method:
have in mind that this code can be used for >2.8 and older versions of wordpress. |
||||
|
||||
|
|