With the package wp-source
we have to set a URL for the REST API server that is going to provide the data. This URL is set as the value of state.source.api
module.exports = {
packages: [
"@frontity/mars-theme",
"@frontity/tiny-router",
{
name: "@frontity/wp-source",
state: {
source: {
api: "https://site.com/wp-json",
},
},
},
],
};
The format of this URL may vary depending on the type of Wordpress installation you want to use as a source of data.
For a self-hosted WordPress site (i.e. local or web based) it would be something like:
http://your-wp-domain.com/wp-json
For a wordpress.com site it would be something like:
https://public-api.wordpress.com/wp/v2/sites/your-wp-site.wordpress.com
In the case of self-hosted WordPress site, most of the sites recommend using the following format
http://yoursite.com/wp-json/wp/v2
As I understand this shows you only the part of the data that is under the namespace /wp/v2
For example If we go to https://test.frontity.org/wp-json/ we can see
But if we go to https://test.frontity.org/wp-json/wp/v2 we only see the part corresponding to /wp/v2
So, I understand the format required is just https://test.frontity.org/wp-json/
so Frontity can also acesss to other namespaces like:
-
contact-form-7/v1
ā Contact Form plugin data -
yoast/v1
&yoast/v1/myyoast
ā Yoast plugin data -
acf/v3
ā Advanced Custom Fields plugin data - and othersā¦
But what happens to the sites hosted in wordpress.com where api.source.data
is using https://public-api.wordpress.com/wp/v2/sites/your-wp-site.wordpress.com ?
For example: https://public-api.wordpress.com/wp/v2/sites/juanmaguitarblog.wordpress.com
Isnāt this showing just the namespace /wp/v2
?
I understand the free wordpress.com sites doesnāt allow you to install plugins but paid ones do.
What happen to these wordpress sites that have plugins installed?
Is there a different URL to be set in these cases?
And regarding self-hosted sitesā¦
Couldnāt be Frontity smart enough to accepts either http://yoursite.com/wp-json/wp/v2
and http://yoursite.com/wp-json/
and take only the part that works? Is it doing this right now?