• Resolved Tim

    (@timwakeling-1)


    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

    https://www.ads-software.com/plugins/wp-page-widget/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author CodeAndMore

    (@codeandmore)

    Yeah there are things can not be handled by the plugin but manual. Good luck.

    Thread Starter Tim

    (@timwakeling-1)

    Thanks! In the end I just removed the widget areas from the theme and put in PHP do_widget() calls to each widget that I wanted. Flexibility with widgets was not really required for this client so it worked fine in that case. ??

    Plugin Author CodeAndMore

    (@codeandmore)

    Yeah that is great.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to add widgets to pages programmatically’ is closed to new replies.