Site logo

Archived topic

What is required for the hook generate_add_sites in Site Library module?

5 replies · Started by Thiago Senna on July 1, 2021

Viewing posts 1–6 of 6

Hi,

I was studying site-library module source code and I saw that now we have a hook named generate_add_sites. Very easy to understand how to add new sites using this filter. But not very easy to find exactly what data I need within the directory and plugins array keys.

If I understood correctly within the directory we must add a URL having inside at least two files:

- options.json (maybe an exported generatepress configuration file)
- content.xml (maybe an exported website using the default WordPress export feature)

Am I correct? Does exists something I need to know to properly setup the filter and have a nice experience importing sites like when importing from your official sites library?

Hi there,

Am I correct? Does exists something I need to know to properly setup the filter and have a nice experience importing sites like when importing from your official sites library?

I'm not exactly sure what the question is.

As far as importing site library templates is concerned, the current UI should be enough.

It's simply:

you click import > your site sends a download request from GP servers > GP servers send the files and plugin installation instructions > GPP plugin adds what was requested.

Any particular reason why you need a filter?

Hi Elvin,

the reason I need the filter is 'cause maybe I'd like to host my own site libraries. I just want to make sure if all I need is the exported content.xml and options.json files. Are there other exported files who should be provided that I'm no aware of?

Hi there,

You're correct, you at least need the options.json file and content.xml file.

You can also add a screenshot.png file for the screenshot, and a widgets.wie file exported using this plugin: https://wordpress.org/plugins/widget-importer-exporter/

That's it!

Let us know if you have any other questions :)

Hi,

thanks very much for the help :)

No problem!

This archived topic is closed to new replies.