GithubHelp home page GithubHelp logo

Comments (4)

harrisonfm avatar harrisonfm commented on June 1, 2024

https://developer.wordpress.org/reference/functions/do_shortcode/

You are executing your shortcodes in PHP, right?

from vuejs-wordpress-theme-starter.

SSCombined avatar SSCombined commented on June 1, 2024

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.

  1. First of all my Pages are being handled as Posts.

  2. 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.

afbeelding

Not sure how to fix this since I get the same results on every fresh WP installation.

from vuejs-wordpress-theme-starter.

harrisonfm avatar harrisonfm commented on June 1, 2024

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.

SSCombined avatar SSCombined commented on June 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.