How to add widgets to pages programmatically
-
I’m setting up a network for a client. The network will have a number of sub-sites, and each one needs to have certain pages set up by default, through running a script.
These pages need to have widgets defined as well – for example, I have a widget called “Post List” that I wish to put in the right hand column of the home page by default. Then the user could remove it if they wished, but it would be there initially. But I cannot go through each site and click this widget into place on every home page one by one. It has to be done via the script.
I tried to reverse-engineer what was happening by entering things into the database myself, and by looking at what the plugin does when it adds a widget to a sidebar on a page, but I couldn’t work it out.
Any clues?
Thanks!
Tim
- The topic ‘How to add widgets to pages programmatically’ is closed to new replies.