Comments (4)
https://developer.wordpress.org/reference/functions/do_shortcode/
You are executing your shortcodes in PHP, right?
from vuejs-wordpress-theme-starter.
https://developer.wordpress.org/reference/functions/do_shortcode/
You are executing your shortcodes in PHP, right?
I actually just found out what is causing this issue, but I'm not sure how to resolve it.
-
First of all my Pages are being handled as Posts.
-
So apparently the wordpress API needs to return an object from what I see from examples.
For example if I grab a random wordpress website and do the following:https://wpdemo.net/wp-json/wp/v2/pages?slug=home
It returns a full object with all the page data.
However if I do something like that I get the following
No object or anything, just the HTML of the page I'm calling only.
Not sure how to fix this since I get the same results on every fresh WP installation.
from vuejs-wordpress-theme-starter.
I'm not really sure what you're asking. Are you saying that your pages are being routed as posts in Vue? If so, that's easy to fix in the Router.
Are you not happy with the default returns from WP REST API? You can overwrite those and get your data however you need. getPostWithShortcodes for example.
from vuejs-wordpress-theme-starter.
I'm super stupid apparently.
What I did in my custom shortcodes was
$shortcode_template = PLUGIN_PATH . 'public/partials/customers/blocks/customer.php';
include_once($shortcode_template);
This caused my page to mess up completely
I changed it to this.
$shortcode_template = PLUGIN_PATH . 'public/partials/customers/blocks/customer.php';
ob_start();
include_once($shortcode_template);
$content = ob_get_clean();
return $content;
And now my json is outputting correctly. This was an issue on my end.
from vuejs-wordpress-theme-starter.
Related Issues (20)
- Where does /src/api/index.js get included from? HOT 2
- Do we have an 404 page? HOT 3
- Off topic: use separate environment for the actual theme
- State error and can't connect to api HOT 10
- Best Way to Add Reactive Components to Posts / Pages?
- Font loading HOT 4
- problem when running npm run watch HOT 10
- Custom SASS file loading as assets?
- UglifyJS is still present?
- Deprecated ExtractTextWebpackPlugin blocking upgrades (Tailwind 2, PostCSS) HOT 1
- No content displaying HOT 3
- Error in posts and header nav HOT 3
- TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator)) HOT 5
- WordPress and VueJS routing problem HOT 2
- ERROR in ./src/app.js HOT 2
- how add new posttype
- npm ERR! missing script: build HOT 1
- Still actively maintained? HOT 2
- Vue 3, Pinia
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vuejs-wordpress-theme-starter.