Theming With WP REST API - Part 14 - Adding Custom Fields

  Рет қаралды 8,349

Watch and Learn

Watch and Learn

Күн бұрын

Пікірлер: 25
@MirkoEckhardt
@MirkoEckhardt 7 жыл бұрын
The best Vue.js WordPress REST Course on KZbin a have seen so far . Thanks a lot for sharing you knowledge!
@MarinStoyanov
@MarinStoyanov 4 жыл бұрын
Thank you for the good explanation. The implementation of adding custom fields to the WP REST API still works in 2020.
@WatchandLearnTutorials
@WatchandLearnTutorials 4 жыл бұрын
Good to know. Thanks ;)
@Allensph
@Allensph 5 жыл бұрын
For anyone who Interests: Toolset Type do not offically support REST API on it's custom fields yet. But I found a plugin called "WP REST API Controller" is able to active Custom Fields built with Toolset Type, and it provide custom meta key to rename default like 'wpcf-...' It works like a charm for me.
@ashkanahmadi
@ashkanahmadi 3 жыл бұрын
Excellent thanks. This method still works in 2021. Is there a newer more updated method of doing this?
@WatchandLearnTutorials
@WatchandLearnTutorials 3 жыл бұрын
Yeah, there are new methods of doing this. Vue is now in version 3.0 I think, also there is something called Nuxt.js (Vue framework) which is way better for doing this since it has server side rendering, and with it you will get much better SEO. I have a series about Nuxt and WP: kzbin.info/aero/PLUBR53Dw-Ef9JLwJaZilBFRn03QoC8ZCT but that may be a bit outdated also. You can also check out this series: kzbin.info/aero/PLUBR53Dw-Ef_oTLzPB3G5CdLWnGOSsec3 but this uses Next.js which is a React framework very similar to Nuxt.js and Strapi is used as CMS/API. But the general idea is the same, so you can take a look at that to get the main concepts.
@xanderseren2726
@xanderseren2726 8 жыл бұрын
I am using toolset for custom fields and have a 'date' field that allows for multiple dates to be added (this is an option when setting a date field in toolset). When I use this method to grab the date field only the first date is pushed through to the rest api. Any insight on how I would grab the multiple dates if more than one is added? These videos have been super helpful. Thank you!
@Genuus1
@Genuus1 4 жыл бұрын
Works great! But how about images? When I outputs custom field in this way - I'm getting just a number insead of image
@Genuus1
@Genuus1 4 жыл бұрын
actually it's ok with images. But how to add more than one field?
@martynasb
@martynasb 7 жыл бұрын
Hey, you are doing great job making video tutorials. One issue about custom fields: how you deal with the occasion, when you need a custom field not for EVERY post of your particular post type but, for instance, some settings fields for ALL posts of that type? Probably, I would use Option Tree plugin, but I think it would be better to extend post type with "Settings" (under "All items", "Add new" in that menu, for example). In that page there would be some fields which could be used (printed) in theme files. So I would suggest to make some kind of tutorial, dealing with this situation. Or maybe there are other solutions, which you prefer.
@ivan747
@ivan747 7 жыл бұрын
I deal with it with Option Tree Plugin :) ... sometimes with ACF options plugin, which does the same thing just inside the ACF framework. I don't think there is a need for doing this some special way. Because Option tree and ACF a really great plugins, so no need to make your own solution for that IMO.
@kasramy8845
@kasramy8845 6 жыл бұрын
Thank you very much bro for the nice useful tutorial. Could you please let us know how can we add a Repeater Custom Feld to the api as well?
@WatchandLearnTutorials
@WatchandLearnTutorials 6 жыл бұрын
This tutorial is more than two years old, and I don't do much of WP development anymore. So honestly I don't know. You can maybe ask on Stack Overflow or ACF forums how to register repeater fields to the API.
@mohammadumar443
@mohammadumar443 5 жыл бұрын
if we want to add more than one custom field of ACF then what would be the way?
@WatchandLearnTutorials
@WatchandLearnTutorials 5 жыл бұрын
The same way you register one field :) ... but if you wan't to have less code, you can try something like this: github.com/WP-API/WP-API/issues/2137 - so putting your register_rest_field function in foreach loop.
@mohammadumar443
@mohammadumar443 5 жыл бұрын
@@WatchandLearnTutorials thanks for your reply. it's awesome. but it adds key of custom field not value. How can i get value in jquery or ajax using that key? second i am not able to get value of relation custom field in function.php can you please help me out. it will be huge favour.?
@mohammadumar443
@mohammadumar443 5 жыл бұрын
@@WatchandLearnTutorials @Watch and Learn thanks for your reply. it's awesome. but it adds key of custom field not value. How can i get value in jquery or ajax using that key? second i am not able to get value of relation advance custom fields in functions.php. I searchd internat but not finding any solution please help me out in this also
@WatchandLearnTutorials
@WatchandLearnTutorials 5 жыл бұрын
@@mohammadumar443 Sorry man, as you can see this video is almost 3 years old, and I haven't touch WP Rest for almost all that time. So I don't remember most of it. Maybe better ask at Stack Overflow, or WordPress forums.
@mohammadumar443
@mohammadumar443 5 жыл бұрын
no problem. I solved the issue with another foreach loop inside an wp query loop... is it ok to have another loop in loop,?thanks for ur help
@androidapps2905
@androidapps2905 5 жыл бұрын
How can I do same thing for product extra field woocommerce?
@WatchandLearnTutorials
@WatchandLearnTutorials 5 жыл бұрын
I don't know. Haven't worked with Woo in ages.
@VIKASH1870
@VIKASH1870 7 жыл бұрын
best vue course still
@tylerolthuizen3347
@tylerolthuizen3347 7 жыл бұрын
6:08 the story of my life ahah :(
@WatchandLearnTutorials
@WatchandLearnTutorials 7 жыл бұрын
:D
Theming With WP REST API - Part 15 - Add Image To Post Type
5:06
Watch and Learn
Рет қаралды 4,2 М.
Cool Parenting Gadget Against Mosquitos! 🦟👶 #gen
00:21
TheSoul Music Family
Рет қаралды 26 МЛН
MY HEIGHT vs MrBEAST CREW 🙈📏
00:22
Celine Dept
Рет қаралды 42 МЛН
WP REST API - Custom Post Types And Fields
8:04
Watch and Learn
Рет қаралды 30 М.
The Big Headless CMS Lie (James Mikrut)
18:14
Vercel
Рет қаралды 63 М.
All useEffect Mistakes Every Junior React Developer Makes
22:23
I built the same app 10 times // Which JS Framework is best?
21:58
Fireship
Рет қаралды 2,5 МЛН
WP REST API - Custom Endpoints
14:00
Watch and Learn
Рет қаралды 79 М.
Theming With WP REST API - Part 02 - Listing Posts
20:55
Watch and Learn
Рет қаралды 15 М.
Theming With WP REST API - Part 01 - Setup
16:47
Watch and Learn
Рет қаралды 32 М.
Ryan Dahl introduces JSR at DevWorld 2024
29:13
Deno
Рет қаралды 112 М.