Hello, I really love this working on something and wanted to utilise the same approach to extend woocommerce's API, cureently I am stuck and was wondering if you can help me think it through.
@TechiePress3 жыл бұрын
Reach out via Web@mediauganda.com with some details and we can work something out
@ltonchis12452 жыл бұрын
Great videos! Question: is it possible to Update meta field and then trigger code? 🤔😮😂
@TechiePress2 жыл бұрын
Yeah, it’s possible. Just need to get the logic right. If you save it via the editor, use the save_post hook.
@jyotibarasker27922 жыл бұрын
Your video is excellent. Right now we are going to use Wordpress as headless cms and angular for the front end my query is how we can display the post view, likes and comment on the angular front end which updated post view, likes and comment from the angular frontend on the Wordpress backend. Can you please help me and give me some idea how we can achieve this?
@TechiePress2 жыл бұрын
You will need to create an endpoint that stores a meta field on each post. Then use angular to do the like button click and send the data over http to save in the post meta. Then you can call that meta field in the display on the front end headless. Using something like WPGraphQL might be the best option
@alexdabruh Жыл бұрын
This is super helpful, but can this way be use to trigger a wp_mail or php mail call? I embedded a react app for my client’s website with a form submission component that I will like to generate an email after each submission
@TechiePress Жыл бұрын
Yes, absolutely
@TORMENTUMM Жыл бұрын
I want to extend the api but to make post and get requests for CRUD operations on the wordpress database. How could I do it?
@TechiePress Жыл бұрын
You can make CRUD functionality in the callback function that you pass to the endpoints. That will work just fine. If you need some crud examples, I do some stuff here kzbin.info/aero/PLNqG1qGUllk0Ov_KPxypiZ-4ZzwW5pyPz
@kyraex4414 Жыл бұрын
Can this be written in code snippet?
@TechiePress Жыл бұрын
Yes. Just add the ice to your snippet handing plugin and you are good to go
@Gigabyteserviceofficial3 жыл бұрын
so it can handle all CRUD operations?
@TechiePress3 жыл бұрын
Yes it can.
@Gigabyteserviceofficial3 жыл бұрын
@@TechiePress where we can define 'post_type' => 'our-custom-post-type' if we want to do samething for custom post type
@TechiePress3 жыл бұрын
At the same line. Just change the post_type post to your custom post type. So you would have something like 'post_type' => 'custom_post_type_name'
@Gigabyteserviceofficial3 жыл бұрын
@@TechiePress THANKS am I right? register_rest_field( 'jit_image', // my custom post type is jits_image 'my_custom_field_for_custom_post_type', array(..........
@Gigabyteserviceofficial3 жыл бұрын
@@TechiePress let's supposed my call back function is jit_image() then how to add offset to custom post type in wordpress api register_rest_route('jit/v1', 'media', [ 'methods' => 'POST', 'callback' => 'jit_images', 'permission_callback' => function() { return current_user_can('edit_posts'); } ]); function jit_images() { $args = [ 'numberposts' => 99999, 'post_type' => 'jit_image' ]; $posts = get_posts($args); $data = []; $i = 0; foreach($posts as $post) { $data[$i]['image']['thumbnail'] = get_the_post_thumbnail_url($post->ID, 'thumbnail'); $data[$i]['image']['medium'] = get_the_post_thumbnail_url($post->ID, 'medium'); $data[$i]['image']['large'] = get_the_post_thumbnail_url($post->ID, 'large'); $i++; } return $data; I want to allow my client-side app to fetch all custom posts but by pagination meaning offset = 10 so in each request, they will get 10 post's data not all 1000 data otherwise I think Mysq will take lots of loads. Please also share how to send requests e.g in postman like what should I include into a header or in the body as JSON data to get new 10 posts on each request.
@TestTest-hk9oh2 жыл бұрын
Your video is excellent. Right now we are going to use Wordpress as headless cms and angular for the front end my query is how we can display the post view, likes and comment on the angular front end which updated post view, likes and comment from the angular frontend on the Wordpress backend. Can you please help me and give me some idea how we can achieve this?
@TechiePress2 жыл бұрын
You will need to create an endpoint that stores a meta field on each post. Then use angular to do the like button click and send the data over http to save in the post meta. Then you can call that meta field in the display on the front end headless.