Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newbie trying to make sense of it. #18

Open
ghost opened this issue Feb 11, 2020 · 3 comments
Open

Newbie trying to make sense of it. #18

ghost opened this issue Feb 11, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented Feb 11, 2020

Hi. I will intensely work with this for the next few weeks (or at least, this is what I highly hope to do if my manager allows the project to continue).

I am a beginner in Vue, like, really nub. I know the basics, I understand the MVC model, the directives and stuff like that. My issue:

Is anybody here available for a couple of hours of chit chat on this subject? I'm seeking for help to understand the following:

  • How does the Vue receive the data from WordPress - How can I alter this, and how can I add post types and meta fields (from acf, for example) to my Vue?

  • How can I make components behave based on an external state, or ones state (actually I have a pretty good idea about this but haven't done it yet so I'll just lay it off here)?

  • How can I make it valid and make sure I don't write shitty code?

There are surely more How to's but I haven't hit them yet.

Even if no response is given to this issue, I am willing to discover those and log them here; for new people that might be using this and find their selves in this situation.

Hopefully it's approved for display,
Kind regards.

@shubhra14
Copy link

I'd highly recommend buying this course. It covers all the nitty gritties and is easy to follow. Also, doesn't cost much (always some offer going on). There are some free courses as well in there that I haven't looked into.

@ghost
Copy link
Author

ghost commented Feb 12, 2020

I'd highly recommend buying this course. It covers all the nitty gritties and is easy to follow. Also, doesn't cost much (always some offer going on). There are some free courses as well in there that I haven't looked into.

Yep I'll probably do that after finishing 'Up and running with Vue' from O'Reilley, but at the moment my main concern and focus is to understand the in-betweens of wordpress and vue with this RADL instance.

I've created a new endpoint in functions.php for categories with some certain ID, but that doesn't seem to be enaugh to pull it into my Vue.

@ghost
Copy link
Author

ghost commented Feb 12, 2020

I'd highly recommend buying this course. It covers all the nitty gritties and is easy to follow. Also, doesn't cost much (always some offer going on). There are some free courses as well in there that I haven't looked into.

Yep I'll probably do that after finishing 'Up and running with Vue' from O'Reilley, but at the moment my main concern and focus is to understand the in-betweens of wordpress and vue with this RADL instance.

I've created a new endpoint in functions.php for categories with some certain ID, but that doesn't seem to be enaugh to pull it into my Vue.

Following up with this. I've managed to insert the data into the store so I can use it with all components. However, did not managed to succeed with a new endpoint; I receive the "code": "rest_no_route", "No route was found matching the URL and request method", when I try to access a custom route.

Steps:

  1. 'retreats' => RADL::callback('retreats'), -> instantiated the VUE_WORDPRESS store with a new structure of mixed values
  2. the callback is a function that queries wordpress and returnes the posts + appended to them the acf fields, inserted within the function. the code is as follows:
function retreats(){
    $retreats = [];
    $args = array(
        'post_type' => 'post',
        'category_name' => 'retreats'
    );
    $the_query = get_posts($args);
    foreach ($the_query as $key => $post){
        $retreats[$key] = $post;
        $retreats[$key]->acf = get_fields($post->ID); 
    }
    return $retreats;
}

to quick-view the data in a raw format I'm using this.$store.state.retreats. I'll follow up with actions, mutations and getters for those, hopefully :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant