yashha / wp-nuxt Goto Github PK
View Code? Open in Web Editor NEWNOT MAINTAINED The module adds WP-API to your nuxt application.
Home Page: https://wp-nuxt.netlify.com/
License: MIT License
NOT MAINTAINED The module adds WP-API to your nuxt application.
Home Page: https://wp-nuxt.netlify.com/
License: MIT License
Hey there,
I am using wp-nuxt to integrate a wordpress multisite-network (mutliple languages). So far it works great, however I am having a hard time figuring out whether or not it is possible to define multiple endpoints in the nuxt.config.js, like in the following example.
This is the standard way defining one WPAPI
instance which can be referenced using this.$wp in vuex:
nuxt.config.js
...
modules: [
"wp-nuxt",
],
wp: {
endpoint: "http://cmshost/wp-json/",
}
...
Now, I want to have a second (or more) WPAPI
instance(s) providing a different endpoint. In my case the endpoint would vary by locale:
nuxt.config.js
...
modules: [
"wp-nuxt",
],
wp: {
endpoint: ["http://cmshost/wp-json/", "http://cmshost/wp-json/de"],
}
...
Is this possible using wp-nuxt or do I need to change using node-wpapi directly and do the nuxt integration myself?
Thanks in advance,
Valentin
Hello
Is it possible to change endpoint in runtime?
My aim is when language changes, set endpoint to another url.
Thanks
Routes as: "wp/v2/custom-taxonomy" aren't visible.
Module node-wpapi
don't accept .discovery()
function - undefined right now.
Right now solution:
Need to add plugin to nuxt.config.js
as custom plugin plugins/wpapi-extend.js
:
export default ({ app }) => {
app.$wp.customTaxonomy = app.$wp.registerRoute( 'wp/v2', '/custom-taxonomy');
app.$wp.customTaxonomy = app.$wp.registerRoute( 'wp/v2', '/custom-taxonomy/(?P<id>[\\d]+)' );
}
Refer:
https://github.com/WP-API/node-wpapi/tree/v1#auto-discovery
Hint:
Add option to module setting adding new routes from array of object.
Example:
{
"extension" : "wp/v2",
"route" : "custom-taxonomy",
"name" : "customTaxonomy" //Default PascalCode, option to have unique name if similar with default ones
}
We have an issue when we are using wp-nuxt out of the box on ie11, we get a syntax error in the superagent library (yarn run dev -> vendor.app.js):
.forEach(fn => {
Problem is that arrow-functions (and other ES6) do not work in ie11, so we added all libraries to transpile in the build option. That solves the first error and a couple of others that are following and are ES6 related. Unfortunately, now we are stuck with the following error, which we can't find any fix for (vendor.app.js): "Unable to get property 'replace' of undefined or null reference".
namedGroupedPattern.replace(
Is there a fix for that?
https://github.com/northosts/wuxt/tree/master/nuxt/modules/wp-api
https://github.com/northosts/wuxt/tree/master/wp-content/mu-plugins/wuxt-headless-wp-api-extensions
It would be good to log when the api point is not reachable, when executing a certain cmd.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.