This offer expires 13th December 2023
On this episode of WP Builds Webinars, we dive into the third part of our Gato GraphQL Webinar Series… Translating content, interacting with external services, importing / distributing content
From addressing the challenges of content translation, importing, and distribution across multiple sites to the seamless integration of Gato GraphQL with WordPress, this episode serves as an indispensable resource for website owners, developers, and enthusiasts alike.
Join Leo as he dissects the transformative potential of Gato GraphQL and shares valuable insights into the practical implications of its utilisation. The episode provides a comprehensive overview of the pivotal role that Gato GraphQL plays in streamlining website management and maximising efficiency.
Embrace the opportunity to gain firsthand knowledge as Leo delves into the complexities of duplicating and translating posts, managing multilingual content, and exploring the dynamic landscape of website management using Gato GraphQL.
Whether you’re seeking guidance on overcoming technical obstacles, harnessing the full potential of Gato GraphQL, or simply looking for the latest developments in the WordPress space, this episode has something for everyone.
We talk about:
- [00:00] Fabulous plugin Gato GraphQL introduced by Leo.
- [05:48] Opening server for demonstration, accessible to all.
- [07:06] Install WP site with predefined persistent queries.
- [10:22] Customise queries.
- [15:47] Video, audio, WordPress editor, Translate Post query.
- [17:14] Translating and formatting content in English and Spanish.
- [21:42] Defining graphical variable for data transformation process.
- [25:02] Translate multiple posts at once for accuracy.
- [29:17] WordPress translation feature demonstration and data handling.
- [31:34] Translate and integrate markdown using single tool.
- [34:57] Duplicate and transform custom post types across websites.
- [36:15] Troubleshooting importing post with Slack error.
- [40:46] Using Gato GraphQL to create temporary translation site.
- [43:37] Import data from URL, convert to JSON.
- [48:56] Custom private endpoint for posting content creation.
- [53:19] Admitting confusion and forgetfulness, need to check.
- [53:54] Leo’s work can be seen at wpbuilds.com/demos-archive.
Useful links from the show:
[00:00:04] Nathan Wrigley: This episode of the WP Builds podcast is brought to you today by Omnisend the top rated email and SMS marketing platform for WordPress. More than a hundred thousand merchants use Omnisend every day to grow their audience and sales. Ready to start building campaigns that really sell? Find out more at www.omnisend.com.
And by GoDaddy Pro, the home of managed WordPress hosting that includes free domain, SSL, and 24 7 support. Bundle that with The Hub by GoDaddy Pro to unlock more free benefits to manage multiple sites in one place, invoice clients, and get 30% of new purchases. You can find out more at go.me/wpbuilds.
Hello? Hello? Hello. That logo on that video gets awfully big by the end. I've only just noticed how large it is. I'm gonna have to fix that. It's Leo. Look over there, Leo. No, it stops with you. You are the only one. Okay. It's Leo Lozoviz. Yeah. There you exactly. Pointing at your head. He's right at the other side of the planet.
and it would be amazing if I could reach through that screen and my hand came through, but, I can't. I would have a 10,000 mile long arm. Leo Lozoviz has joined us on two previous occasions on this webinar. He's also joined us on the podcast. He has a fabulously. Cool plugin called Gato Graph ql.
maybe just pause, or open up a new tab maybe and go and Google it GATO and then a space and then graph QL without a space and, and see what it can do. But if you can't be bothered to do that, and you would like Leo to show you what it can do, that's why you're here. on previous episodes of this webinar series, we got introduced to GraphQL and running queries and all of that good stuff.
And then we had an episode where it w we were showing how you could, customize content, duplicate posts, and many other things. We never quite got through everything. Today we were gonna be doing one thing, but Leo's had a bit of a change of heart, and he's swapped the order around a little bit. So firstly, Leo, what are we doing today?
What's on the agenda?
[00:02:23] Leo Losoviz: we're going to see translation and importing and distributing content across sites.
[00:02:31] Nathan Wrigley: Fabulous stuff. we'll get stuck into that in just a moment. A few bits of housekeeping. I know we do this every single episode, but unless we do, somebody complains. if you want to make a comment, if you would like to offer a question up to Leo or something like that, feel free.
Don't be shy. the best way to do that is to go to this page, wp builds.com/live. If you're logged into a Google account, then you can use the YouTube comments, which is a box on the side or underneath on mobile. If you don't want to be logged into anything, there's a little button inside the video. Top right of the video, it says something like live chat.
It's black little button. Click that and you don't have to be logged into anything. You just type your name in and you're off to the races. You can put a comment in there. If you are watching this on Facebook, they don't allow us to have your name. So go here, wave video slash lives slash Facebook and and you'll be able to, give us a comment there.
I got a bit freaked out then, Leo, because over your shoulder, your cat. Just arrived and
[00:03:31] Leo Losoviz: actually this is the cat,
[00:03:36] Nathan Wrigley: the of the plugin.
[00:03:40] Leo Losoviz: That's great.
[00:03:42] Nathan Wrigley: Yeah. Can you see logo? Oh, look at the little thing.
[00:03:46] Leo Losoviz: Little pushy. Remember, this face?
[00:03:48] Nathan Wrigley: Yeah. You are entirely responsible. Little cat. Everything
[00:03:54] Leo Losoviz: that goes on.
Luckily the cat doesn't understand what's going on. Have to ask me for any compensation, copyright, or anything.
[00:04:00] Nathan Wrigley: Do you know what Leo? I don't understand half of what your plugin does, that's why it's necessary to have you here. But yeah, if you go to the gra gato graph, QL plugin, you will see a cat all over the place.
There's cat logos everywhere, and that is the very cat. So that's fun. That's the cat? Yeah, that's the cat. Okay. So what are we doing today then? What's, what, are we gonna do? We're gonna do translating content, interacting with external services, importing, distribute, distributing content.
Maybe that's it. Yeah.
[00:04:27] Leo Losoviz: Yeah, a bit. yeah, that concept wise, yes. I have a list that I'm going to show when you share my screen. Okay. Shall
[00:04:35] Nathan Wrigley: I share your screen now or is it gonna do that loop into infinity? okay. Okay. We're ready. Perfect. There you go. There's your screen.
[00:04:45] Leo Losoviz: Sorry. Yeah. So's here we are.
So this is my, the program for today. So it's a bit, there, there are things that, that will, that I planned for the fourth episode, but now I have rearranged them. so it's going to be translating content and importing, distributing content across websites. What we're going to see, and I have, some new development that I'm going to show you now.
Oh, okay. Let's start. Yeah. So actually I'm quite actually excited to have done this that I'm going to show you now. So to start, You have to, this is, oh, you can see the, screen here. So this is the cat. That's the cat there.
[00:05:24] Nathan Wrigley: There's the cat twice. Yeah. Lemme yeah. Do it again. I love it.
Look, let's see how accurate is the logo? Yes, I can see the little brown smudge going down between the eyes. Very nice. Green eyes, little cat. Okay, where would we be without cats? Great.
[00:05:48] Leo Losoviz: I'm going to open a server, like a testing site to demonstrate what I'm going to do today. And so as much as I'm doing this, you guys on the other side of, the screen, you can do the same.
So if you come to the website here and you scroll all the way down a bit more, Here, I say button does play with Gato. GraphQL in a testing site. I'm going to click there. This is a, install. WP. You can open, you can create a, site, with Gato, GraphQL, and the extensions installed.
So once again, Gato, it's free. Oh, and it's going to be soon in the WordPress directory. That's, oh, that's happening, is it? That's great. Yeah, because it's been approved. Hey,
[00:06:38] Nathan Wrigley: well done. What was that like 90 days or more? More, yeah, more. It's hard work. That, isn't it? There's a lot of, plugins and not enough people doing the Yeah.
Doing the vetting, yeah.
[00:06:49] Leo Losoviz: Yeah. I still need to work a bit on releasing it. yeah. And a few weeks and it's going to be up there. Yes. So it. Free the plugin, but then the extensions are commercial and what I'm going to be demonstrating is a combination of both. So some functionality are free.
Some of them you will need some extension to run them. So now this is the my Install WP site. And the first thing that I wanted to show you is here is this thing called predefined persistent queries. So if you remember the previous two episodes I do, when I wanted to demonstrate something, what I did.
Was to come here to a section called Recipes, and here we will go to the section that I want to demonstrate on like retrieving structured data. And I'll ask you to copy the query. Yeah. And then I will go to the. client and I will paste the query. Yeah, there was a bit of copying and
[00:07:51] Nathan Wrigley: pasting going on.
[00:07:52] Leo Losoviz: Yeah. Yeah. And I'll execute it. Okay. I had to pass some, somewhere. It was a bit of a mess because I don't know it like too many steps and that section recipes was, is meant to explain how it works, but I found out that people want solutions and they don't necessarily want to understand how it works.
They're like, I'm interacting with people and they're like, I just want to solve the problem. I need Something that works in 10 seconds. Yeah. Yes. Good point. Yep. Yep. So I was thinking, all right, there, there are these plugins for, running snippets of code, like PHP code. Yeah. You have WP Code and you have code snippets, right?
Yeah. you, had, a podcast with the cost snippets, right?
[00:08:37] Nathan Wrigley: I had a podcast with, Vidoo from, WP Code Box. and that, that was a little while ago. That's pretty impressive.
[00:08:47] Leo Losoviz: Yeah. Yeah. So I'm doing kind of the same, but using GraphQL queries. they thing called persistent queries that I had already shown.
Now, the novel team, what I have called the Prefin process queries, is that all of these use cases that I'm demonstrating, they're already. Predefined on the plugin. So when you start the plugin, they're already here. Nice. Yeah. So now, instead of having to go to the recipe, copy the query, paste it on the client and run it, it's already created.
You just have to go to the corresponding recipe of the query and just execute it straight. It's already created. Ah. So let's see. The first one, the first one is d duplicating in post.
[00:09:28] Nathan Wrigley: Okay. I do this every single day of the week. Literally every day I do this, I wanna see this one.
[00:09:34] Leo Losoviz: Okay.
So I will just open this in a new tab, and basically this is a custom post type. With the Uhhuh query here, and from here, from this custom post type, I can already execute the query. so here it says what parameters I need to pass the, in this case, the post ID of the post to duplicate. So then I just provide that information post ID 40, and I run this duplicate post.
Okay, boom. Now let's, go to the post and see what happened. Here we are. There it is. So it just created, okay. Maybe I'll, demonstrate again.
[00:10:16] Nathan Wrigley: oh. Yeah. just in case. This, that one. Yeah, There should be another
[00:10:22] Leo Losoviz: one. Here we go. Yay. Now, you have the applicate, the applicator plugin from Yost, and there are options you might think oh, why do I need yet another plugin for this?
Because you have here the query and you can personalize the query to suit your needs. So for instance, in this query here we are fetching the tile. What if you don't want to duplicate it straight, but you want to append a string to the tile when you're applicating. So for instance, here we can do.
I will append the string. Copy. Okay. Copy. Yeah, yeah. So now if I run this again and we come here again, here it is the one that has copy on the table. So this is quite, important that you have the, power to decide how to modify the output of your algorithm, that's not something that you can do with all the other duplicator plugins.
[00:11:22] Nathan Wrigley: No, you just get the choices of what they give you, right? Yeah. And if they add copy, then that's what they do.
[00:11:28] Leo Losoviz: You can put it in. So this is also draft. If you want to publish it straight, you can. If you want to change the author, you can. If you want to set a, different, slag, you can. So basically you have that level of customization.
Can
[00:11:40] Nathan Wrigley: I ask a question? Just a per this, is personally from me. Could I duplicate a post from one custom post type to another custom post type?
[00:11:51] Leo Losoviz: Can you gimme an
[00:11:52] Nathan Wrigley: example? so let's say for example, I have a custom post type of, oh, I don't know, episodes, and I have another custom post type called shows.
Could I go into the episodes, list and say copy. This show, but now I want it to appear in the episodes custom post type. So it's going from one custom post type over
[00:12:11] Leo Losoviz: to another. yeah, absolutely. So actually the, properties which are the same, like custom, all the custom post types, they have a title content, slack.
Yep. Excerpt, status. All of those properties, they're the same. So I just, you can just change the name of the custom post app. Yeah, it will work nice. And then you can also map property may maybe, for instance, you have a meta. On one post type that the equivalent meta has a different name, you can fetch that meta and then save it with a different name.
So then you can also do mapping. So yes, absolutely. Oh,
[00:12:40] Nathan Wrigley: that's gonna save me a lot of time.
[00:12:45] Leo Losoviz: yeah. Okay, nice. So next one is duplicating multiple posts at once. So it's basically the same, but, instead of doing one by one. This is exactly
[00:12:57] Nathan Wrigley: what I need to do. Again, you've hit the nail on the head this week, Leo.
This is perfect.
[00:13:03] Leo Losoviz: let's close this. so there's another processor query called duplicate posts. So here, the way that I am duplicating them is by saying how many are at a given time and starting from which one? The limit. Yep. And the offset. So once I press. Here, retrieve, created post, and I go back.
Okay. Let's go back to the posts that I just closed for, I don't know what reason
[00:13:31] Nathan Wrigley: now. You just did. There are 10 of them for top 10. What is
[00:13:34] Leo Losoviz: it? Yeah, you can see it has the something
[00:13:35] Nathan Wrigley: like Hello world, somewhere like
[00:13:36] Leo Losoviz: that. yeah. Okay. All these ones, which are all draft, they have been duplicated, so you can, in no time, like I mean replicate your database, like all of the posts and then do something with it.
[00:13:47] Nathan Wrigley: Wow. That's so fast.
[00:13:52] Leo Losoviz: Okay, next one. Okay. one thing, Nathan. this might be a problem.
[00:13:58] Nathan Wrigley: Oh, no.
[00:13:59] Leo Losoviz: Oh, dear. When I first designed this, series. The one hour was because I was explaining how it works, but now you can see I run the script and it just works.
[00:14:10] Nathan Wrigley: It's fine. It's totally all right. if we end quicker it, that's great.
No worries. It doesn't have to go for an
[00:14:17] Leo Losoviz: hour. Okay. Next one is let's do some translation. I love this one. Okay, so, persist query. Let's search for that. Translate. Yeah. Okay, so this one, let's open this one. I have two versions. One is for Gutenberg and one is for the classic. I see that. Yeah.
[00:14:40] Nathan Wrigley: Yeah. Classic one as well. Okay. All right.
[00:14:43] Leo Losoviz: I'll, first show you the Gutenberg one. Actually, it is a really, it is a really interesting one. yeah, this
[00:14:48] Nathan Wrigley: is, this is a lot, isn't it? There's a lot going on here.
[00:14:53] Leo Losoviz: I'll show you this. I have a blog post here, using Gutenberg. This one that is full of blocks as the title says, welcome to single post full of blocks.
And it basically many blocks. Right here you have the paragraph block. a tile one, another paragraph block. But it has some properties like some background color. here you have a picture and the caption of the picture and what a picture. and here's also with some formatting, and you have a list.
A, a cover image with some text here that you, we cannot really see, but there it is. here is, a table. No, sorry. This is a nested blocks you have yeah. Which are inside blocks, which are inside blocks that we go. A button. this is a image gallery, another button. And here is a video. I, everything.
Sorry, this audio with the caption audio? Yeah, the video. and here's a table and here's, a YouTube envelope with the, caption. So what we're seeing here is basically the WordPress editor, okay? And what I will do now is to run this persistent query called Translate Post. So it says that I need to pass the post ID and translate and the language to translate it to.
So let's do that Post id. I know that this is 40 and language. What language do you want, Nathan?
[00:16:27] Nathan Wrigley: Oh, I don't know. You speak Spanish, you could go straight into Spanish and then you could be critical of how accurate it was or
[00:16:35] Leo Losoviz: not. Yeah, and I run this, will do one single call to the Google translate, API.
Passing all the strings on the properties in all the blocks. And now if we go back to the post section, let's see here it is. It has D, this one, it has duplicated it. Okay.
[00:16:56] Nathan Wrigley: So duplicated as well as translated, which makes sense, right? Yeah, I have actually, that's right. But it
[00:17:02] Leo Losoviz: looks good. Okay. So actually, this one.
Okay. I'll show you something. Since here we are, we can, there's another property that is update. So if I say Update True. Okay. let's, oh, sorry. Let's just run this. And now my original post that was in English. Now the one is in Spanish. So let's see how this one works. So here you have the title, you have the text, the paragraph, you have the other paragraph with all the formatting, you have the picture and the caption that also have been translated.
You have the list and you have the cover, and you have the blocks inside. Blocks, inside blocks, the image gallery, the bat songs video, the audio inside the table. Everything has been translated
[00:17:57] Nathan Wrigley: unbelievable, like really cool. That's such a time saver. What a fabulous example.
[00:18:07] Leo Losoviz: you don't need to do copy paste.
[00:18:09] Nathan Wrigley: No, it's gone. It's all gone. That is so neat. And obviously, we're reliant upon Google's translate. API they're pretty good though, aren't they? They're really decent. But, caveat all, get somebody to check it, but boy, it's,
[00:18:26] Leo Losoviz: and, actually let me show you something that gets even better.
where we are, which is actually the, next, one, translating multiple posts at once. Now, there's another recipe here that is translate posts. Let's open this one.
This one. Let's, I need to undo. Yeah, you need to go back. You need to put, oh, no, I can translate from
[00:18:53] Nathan Wrigley: Spanish to go back into English. I see how that works. Yeah. what could possibly go
[00:18:59] Leo Losoviz: wrong? What could actually go wrong? we are, you should not innovate in while doing a demo, but, here we are.
I'll open this one. Translate posts, let's see, what is it? Translate to Lang.
Translate too long. So I will just also edit this because it is not part of the recipe of the query and translate from, okay, so
[00:19:33] Nathan Wrigley: you're going into the weeds here a bit.
[00:19:35] Leo Losoviz: Alright. Yeah. So this is basically what I was saying before, that if you need to customize the query, you can just do it. Yeah.
Translate
from. Okay, so now I can provide also the from, so translate. From Spanish and translate to Lang. let's just say Chinese just because, okay. Yeah, because only because we can, right? Just because. Let's see. Yeah, and so this is the important thing post IDs. Then now you can provide many post IDs.
Okay. This one was the one that we just translated, and HelloWorld, we just keep going. Number one. Yeah. I could do like many more, right? yeah. Even though I don't even know if, which, okay. Let's see. but they're not in Spanish though. No, it's okay. Just do, let's do these two.
Doesn't matter. And I translate this,
From Lang. Oh, it has not been defined on the operation. I need to add it. This is why we say that
[00:20:44] Nathan Wrigley: I never go off piece on a demo. I love it. They're better this way. It's more fun. Yeah. And you get to see you at work as well. Seeing how quickly you can navigate around your own plugin is fabulous.
[00:21:02] Leo Losoviz: Translate from lung translate to land. There is,
oh, what's going on? Why is he not there? He's here. Translate to lung, translate from lung.
Yeah, this is why you should not do this.
[00:21:31] Nathan Wrigley: You live and learn. I've, been doing these live things for years and, typically if you do something that you would, it always goes a bit pear shaped.
[00:21:42] Leo Losoviz: What I'm actually doing is you are defining here the, so this is, okay, let's talk a bit about graphical, right?
Yeah, Nice. This is, the variable that you are providing. So once, once you provide the variable here, it is defined on the operation. Here it is. This is the operation. Transform data. Line 6, 5 1. Oh, why don't I just check the error right here. It's saying 6 5 1 9 6 5 1. So
yeah, but here it is. Why is it not? Oh, because it's here. I have to also it here. but why is it not the other one there?
What am I? What's going on? maybe I should not Pretend that this Pull out. Pull out. Yeah. I should not pretend that I know what I'm doing. Back,
[00:22:35] Nathan Wrigley: back away from the demo.
[00:22:38] Leo Losoviz: This is so strange. Why is it not working? Oh,
why is he not taking this? I don't know. He cannot been defining depression, but here it is. 6
[00:22:50] Nathan Wrigley: 5, 1 translation, two string.
[00:22:55] Leo Losoviz: this shouldn't, this is the one that doesn't work.
It's not, is it because I have to update it? No, cannot be, of course, it cannot be.
It's a mystery. let's listen, do, listen, do this, and it is a mystery. Let
[00:23:18] Nathan Wrigley: doing this. We've just not in that specific, case, but we know how this goes, right? We all work in this industry. Things that are supposed to work just confound us. Yeah, I'll bet you'll hang up this call. Yeah.
And four seconds after you've, we've pressed end broadcast, you'll be like, oh, it was so
[00:23:39] Leo Losoviz: obvious it was that. Okay, so this, it did the translation, but this one will not be good. It because, okay. Here is because I said from, you said from, yeah. What did you say from this? Okay. let's do another one.
let's, okay, let me just go back this. Let's do this properly. Two revisions. Let's go back to
[00:23:57] Nathan Wrigley: English. Go back to English and begin again. Oh, yeah.
[00:24:02] Leo Losoviz: Yep. Restore.
[00:24:06] Nathan Wrigley: Ah, did you, not create, was that a copy? What Id Is that,
I think you might have created that. Oh, I have. I think that's the c created copy possibly. Is it as opposed to the original one?
[00:24:21] Leo Losoviz: Oh, is that what it is? Let's see.
It was this one that I modified before. Go for that
[00:24:34] Nathan Wrigley: revision. Oh, you got three
[00:24:35] Leo Losoviz: revisions there. Yeah, but why is he not showing me the one, the first one in English? This is a, yeah. no. That's curious, isn't it? This is a bug. Yeah. That's not you. No, that's this is not me. you,
[00:24:49] Nathan Wrigley: you overwrote the original.
The, original English one, I guess with all the tables
[00:24:55] Leo Losoviz: and all of that stuff in it. Yeah. Yeah. oh,
[00:24:59] Nathan Wrigley: you could always go to Insta WP and start again. It takes three seconds. Yeah.
[00:25:02] Leo Losoviz: Actually I'll do that actually. I, while I'm starting the new one, there we go. I'll keep showing what, why this actually cool, but, so in any case, what I did here, where were we Indeed.
In this one is to pass several posts and Google translate you. the more strings you provide, the better is going to be the translation, right? Depends on the context. So you can actually translate 20 blog posts at the same time in one go. Google Transl receives in one single operation, the data for all 20 blog posts, so that will make the accuracy of the translation much higher.
That's
[00:25:45] Nathan Wrigley: interesting. I did not know that. So you can do things on bulk. In bulk and the bulk.
[00:25:51] Leo Losoviz: Yeah, because basically, you have words which can have different meanings. Even like the word get in English, you can translate it like 20 different ways. yeah. Yep. But if you say, I dunno, get up, you're providing more context, then you know the translation becomes better and better.
Yep. So the more data you provide to Google translate, the more accurate will be the translation. So basically here you can actually translate, I dunno, all the different posts on the site in one single go. Yeah.
[00:26:23] Nathan Wrigley: Yeah. And that way you'll have more, more context and hopefully it'll be more accurate. And you don't have to do it multiple times.
You just put the post IDs in there, one after the other. Easy
[00:26:32] Leo Losoviz: peasy. Yeah. you could also say limit 10 and then, you go like 10 by 10. Yeah. That's maybe a good idea. yeah. But basically you have the chance to do one or the other.
Oh, network error now. Oh no, this is a problem. Instead, WP down.
[00:26:52] Nathan Wrigley: Oh, let's check it from my end. Let me see if it's down over here as well. Hold on. WP this is a bit like when CloudFlare goes down, like the world comes to an end. It's
[00:27:05] Leo Losoviz: yeah, but I need this, I need, instead wp to demonstrate the import,
[00:27:12] Nathan Wrigley: feature.
I'm seeing the front end of Insta WP is still up. I can't say whether their, their backend is still going, but their, website
[00:27:21] Leo Losoviz: is still going. Okay. The one seems to be going today. Not the day. Today. Not the day. That's right.
[00:27:26] Nathan Wrigley: Stupid, stupid Wednesday,
[00:27:29] Leo Losoviz: I think. no, I think it is, in my cut, because she didn't want to be on the screen.
She like, yeah,
[00:27:34] Nathan Wrigley: she's giving you the bad vibes. She came in a moment ago and meowed and, maybe it was that. Oh no, that's another one. oh, multiple. That's one.
[00:27:44] Leo Losoviz: Oh, little cat. Yeah, but this one is not, this one doesn't have any stake in the plugin.
[00:27:54] Nathan Wrigley: Maybe that's it. It's pure jealousy. Come on instant, WP, we know you.
We know you
[00:27:59] Leo Losoviz: can do it. Forta, wp. So in the meantime, okay, translating content from UR L. So this one, I was listening to your podcast the other day with, javier ca. Oh yeah. Yeah. You are you are talking about translating the WordPress project.
[00:28:14] Nathan Wrigley: Yeah. Boy, what a big. Big job that is, but you are here to save the day.
[00:28:22] Leo Losoviz: I, don't think I will. I will save the day. No, I could, I would love to save the day.
[00:28:28] Nathan Wrigley: But, yeah, I think their problem is more, not problem, but their hurdles are more to do with managing how it all happens and who does what and what team gets to do what and when are the strings frozen and all that kind of stuff.
So Yeah. It's complex.
[00:28:41] Leo Losoviz: Yes. Yeah. And one of the challenges they had, different places to. Host to store their content. you, not just, you, not just word precise, but it's the
[00:28:52] Nathan Wrigley: actual backend that they've gotta build to manage the whole thing. That's right. Yeah. They
[00:28:56] Leo Losoviz: have, they have markdown files and then they want to create a structure.
I. following the localization, right? That it is in English and then maybe English from Australia. Yeah. Spanish and then Spanish from Mexico. Yeah. And have that structure. And basically under these folders you have like markdown files that they have been translated for that and localized. And I was actually thinking that, this translate translation feature, you have it here on WordPress.
You are translating what I demonstrated that you're translating the blog post that you have in your site, but you can also translate. Data, I can fetch it from somewhere else, translate it and give it to you again. And then you can do something with it. You can store it on the file under that local that you want.
So that's where I'm going to demonstrate now. Okay. That this is the recipe. You give it a URL and, it will translate the, content in that UL. So actually let's, I have a UL with a markdown file here. Oh.
[00:29:56] Nathan Wrigley: Look how prepared you are. Brilliant.
[00:29:58] Leo Losoviz: yeah, except, you know when I start Yeah. You go off piece, go like innovating inside my demo and then things don't work.
[00:30:08] Nathan Wrigley: Oh, it's life. It's how it goes.
[00:30:11] Leo Losoviz: Yeah. It's, over there. I'm making the, this. This video more interesting. You can actually have check how things completely broke down in the middle of the presentation. make me upside down or something. Yeah. So here, this is just a markdown file that I have on my GitHub repo.
Okay. So I would just copy the URL to, this is the file. I just copy the URL and then let's just close everything that I don't need translate post. This one. I'll come back to this later. Yeah. See how that's going. Yep. Course. Bye-Bye. This one, you're so from Lang English, let's say lan, oops, maybe Lan Spanish once again, and then the URL.
The one that I just copied this markdown file, and I run this. So here it gives me, this is the content of the markdown that he retrieves. And immediately after, it gives me the translation, the markdown translation through the language that I said. So what do you do with this? Something? So basically the idea is, once again, the problem that this, that they had is that.
They need to manage, right? the different translations on the content and everything. But now with this tool, what you could do is to have a single tool that you operate to translate and then get the content and then place it on the markdown file under the local that you want. If it is, like that, this is a markdown file that I'm getting from GitHub.
So you could even integrate this on your, On your GitHub actions? Yeah. When you do a commit or when you merge a pr, maybe the new documentation, and in that moment you make a call that translates the documentation and it saves the file on the proper location and, combined with, also with GI GitHub actions, you can even identify which are the delta.
So instead of translating the call markdown again, you just extract the paragraph that has changed and only translate that And then maybe send an email to the translator saying, Hey, this paragraph have been updated. This is a new translation. Please integrate it. Or something like that. I don't know.
[00:32:30] Nathan Wrigley: Yeah. The, IM possibilities are endless, but the point being you don't have to be sticking with WordPress pages and posts. You can, I. You suck in stuff from anywhere and then decide what to do with it. Yeah. That's amazing.
[00:32:42] Leo Losoviz: Yeah. So yeah, we're listening to that podcast and I was thinking, Hey, that, that is giving me an idea.
And then I created this, have you reached out? Yeah. I, don't think they're going to use it, but anyway. You never know. Yeah. you never know.
[00:32:58] Nathan Wrigley: Good for you for trying. Yeah.
[00:33:00] Leo Losoviz: Okay. Oh, next one. So now we're, we are onto into the importing. a post from a WordPress site to another WordPress site. here I need, oh no.
Oh,
[00:33:13] Nathan Wrigley: stupid, stupid thing. I need to say. Try again. Try again. You never know if you can. Honestly, if it, when it works, it takes about 25 seconds, doesn't it? So it's worth trying again. If it doesn't work, we'll put a pin in it. And we'll come back to it in the final episode and we'll make the other episode longer.
[00:33:32] Leo Losoviz: I, need, I, need to, apologize to VCAs because I'm doing my demo and I'm showing instead of WPN, I thought, Hey, this is so cool. Look, I'm using instead w but I'm actually showing that it goes down every now then I'm sure he'll
[00:33:47] Nathan Wrigley: be gracious. So things go wrong. Anyway, that works. That was about 20 seconds.
Yeah,
[00:33:50] Leo Losoviz: it'll, okay. Yeah. So now we have, two, I have two different, word sites here. And what I will do is I will import one post from one site to another site. Pretty
[00:34:03] Nathan Wrigley: cool. Pretty cool. It's like a mini backup solution. Mini transfer your website to another place solution. You could do the whole thing.
If it was just a collection of posts, you could take the whole site in one go. Nice.
You
[00:34:15] Leo Losoviz: could even though, I don't know if I'll use my plugin for this.
[00:34:19] Nathan Wrigley: No. Yeah, there's definitely different ways of doing it, but if it's just the content you want, you never know.
[00:34:24] Leo Losoviz: Yeah. the thing is, if you want to have a backup, just do a dump of the MySQL database.
Yeah. Or use another plugin like, one of the more dev dedicated ones for backup that then you can restore the backup and everything. GraphQL has, is that you can customize, you can actually go into the specific of how to import data. You can, actually change data in the process.
[00:34:50] Nathan Wrigley: Okay. Got it. So it is not just copy and paste, it's copy, modify and paste kind of thing. Exactly. Got it.
[00:34:57] Leo Losoviz: Got it. Before you, you asked me if you could duplicate a custom post type into different custom post type. Yeah. You can do that also across websites. You can actually across websites, it works a custom post type from this site that you have that plugin, you don't have this plugin, and in your side you have this plugin, but you don't have that plugin.
Got it, And you can import the data and transform from one to the.
[00:35:19] Nathan Wrigley: Okay. Yeah. So the output might be as a result of a plugin, but you on the new site, you don't want the plugin. You don't need the plugin. So long as you've got the output, I'm overcomplicating it, but I get what you mean, right? Yeah.
[00:35:29] Leo Losoviz: Yeah. yeah, let's run this recipe. So this one is import, import post from another WordPress site.
Okay. So here I have the query and it says that I need the sl. Okay. I'm going to, so the post that I have on the two sides, they are the same. Yep. so I will, first I'll grab a post here. I need a slag. Yeah. So basically this is going to copy that post from the other side here. And the first time that I do this, it will fail because the, this already a post here with the same slug.
evidently.
[00:36:12] Nathan Wrigley: okay. That's curious. Okay. Let's see what goes down.
[00:36:15] Leo Losoviz: Yeah. Actually, let's close this. So let's run this. What do I need? Post log. So I said this one, and then which is the other side? The, I need the endpoint from this other side. So if basically this one, the domain
slash graph ql. Now I run this import post. And here it says, it gives me an error post with Slack, right? Size already exists locally, so then of course it cannot import it. So what I will do now is I will need,
[00:36:53] Nathan Wrigley: okay, this is because, just to be clear, this is because you duplicated the site in instant, wp, so you've got an identical roster of posts, so you, it can't, create what's already created.
So I get it. Yeah. Okay, got
[00:37:04] Leo Losoviz: it. Exactly. So basically what I. I'm using the slag to identify the post. Yeah. Because it's easier than an ID when you're talking across sites. Yeah. It's, better to see too match the information that Id, and the ideas will be different for sure, but the slag can be the same.
it's, a way to actually say, oh, I have already imported this post. Yep. So now what I will do is I will delete this post, trash it over there. Got it. And on, on my local computer. And now if I run again this query. Now supposedly it worked. Let's see. Size, motivation. Here it is, back at the top.
[00:37:46] Nathan Wrigley: That is so neat.
[00:37:49] Leo Losoviz: Okay, and here, lo logically, of course I had it also here. Right size. yeah, There it is. Okay, so the same one. That's cool. And it, is importing also the categories and the tag, the whole lot and the author, it has to exist locally again with the same username. I have that restriction is the, if the author doesn't exist and he say Nope, this author doesn't exist.
[00:38:19] Nathan Wrigley: Oh, okay. That's just some sort of basic sanity check. Yeah. Okay. No,
[00:38:24] Leo Losoviz: but that, that can also be, fixed. You can also create an Yeah. Yeah. Even though, I dunno, that's a bit more do you also want to, when you duplicate the post, do you also want to duplicate the author? So I haven't code that in the query, but it can be in the Yeah.
[00:38:39] Nathan Wrigley: In your little recipes. Got it. Yeah. Understood.
[00:38:41] Leo Losoviz: Yeah. Okay, so we are done. This one worked fine. I actually, now that we have this,
[00:38:46] Nathan Wrigley: we go back, we try that one
[00:38:47] Leo Losoviz: again. Yeah. So if that one, the previous one was translate posts. Yeah. Multiple posts at once. it was from English. Oh, sorry, not post. I need to search for the, there you go.
Persist. Queries translate.
Okay. Translate posts. I will open this one and let's see what post we have. So hello Wall is Post ID one and then the one with all the blocks is 14. So I'll just do that. What I did before, again, that went so terribly
[00:39:27] Nathan Wrigley: wrong. Yeah. F fingers crossed this time, if it doesn't work out, we're gonna move on quickly.
pretend like it never happened,
[00:39:35] Leo Losoviz: translate to Lang and this is what I had done. Chinese, actually, let's do a bit more like maybe two more. 16. Okay. 17, nine.
[00:39:46] Nathan Wrigley: Okay. 16, 17, 9.
[00:39:50] Leo Losoviz: Okay. All righty. Cross your fingers. I'm
[00:39:52] Nathan Wrigley: crossing. I run this every, all the things are crossed. All things are Ha. Yeah. Woo-hoo.
[00:39:58] Leo Losoviz: And now if I refresh here, we are.
Look at Chinese, Chinese, Yay. So it translated five post with a single call to the Google translate, API. And that's a really cool thing. So that means that these translations, will be as accurate as they can be.
[00:40:21] Nathan Wrigley: That is remarkable. I have no idea if it's done. It's done a good job.
I'm gonna assume it has. Oh, look at this. You look pretty good at this
[00:40:30] Leo Losoviz: stuff. I got, I understand this.
[00:40:33] Nathan Wrigley: Yeah. Yeah. It left that alone. That is remarkable, Leo. Wow. This tool gets better and better. Bravo.
[00:40:46] Leo Losoviz: actually something very cool that I did, this is, a blog post on the WP Just publish it like one or two days ago that I.
Use Gato GraphQL with, instead WP to create a temporary site for translators to, work on translations and so that you avoid having to give them access to your site in production. Okay. Yeah. So basically, I'm showing you two things just now today, translation and importing posts. So then I use wp, I create a temporary site.
Then I have my production site. I import the content to that site, I translate it, and I give access to my translator, Hey, you can fix this translation. And once the translation is done, they fixing back. They come. I import it back.
[00:41:40] Nathan Wrigley: That's neat. And it takes seconds to do it. We've just seen.
[00:41:44] Leo Losoviz: Yeah. Yay. And it's also a security issue that you don't want to give access to a third party company.
You don't know who they are. You don't want, sometimes they give you you give access to your website and they, check your comments and what plugins you have installed, and you're like, yeah,
[00:42:00] Nathan Wrigley: yeah,
That's a, really neat example of how to do it, isn't it? You just make it much more secure and, lock everything down, put guardrails around it.
we now know it works. So well done. We got through that.
[00:42:14] Leo Losoviz: yeah. Next one is importing from an RSS feed.
[00:42:17] Nathan Wrigley: Oh, this is my favorite. Especially audio. RSS feeds. I podcast. RSS feeds are my thing.
[00:42:25] Leo Losoviz: Yeah. So I have here, this is a blog that I have a single blog post. You can actually, expose the data as RSS from any blog by appending this slash field slash r ss without comments equals one.
If you do that, what you get here is the RSS of that post. Yep. In XML format. So in the previous, examples that I was demonstrating the query, I had GraphQL installed on my local site and also GraphQL installed on the site from which I'm importing. I had an endpoint, which was a site slash GraphQL.
What happens if you don't have GraphQL, but, it's just a normal site, sorry, a normal WordPress site. One option you have is to get the data from the RSS feed instead. So let's run this, this recipe. Translate. We can actually close this. Bye-Bye. let's go to the pre queries here. Import again.
Import from eight. So here I need to provide the URL from what I'm fetching, or this one I don't have an here. If I run it with admin, it will fail because I don't have an admin site in my, in this site. So it's called editor. Okay. And the URL is the RSS that I just mentioned? And if I now import it,
it will go, it will actually fetch this XML data. It will parse it. Now it is as a json and once it is a JS o, I can extract the data and basically create the post. So now if we go back to the post, let's see here it is.
[00:44:29] Nathan Wrigley: Wow. And you did the one post. I'm guessing that you could do more.
[00:44:40] Leo Losoviz: Yeah. Yeah. So you have the RSS field and the RSS.
It gives you, like the data for 10 posts you can import 10 post. Yeah.
[00:44:48] Nathan Wrigley: Yeah. That's neat. That's really neat.
[00:44:54] Leo Losoviz: Oh, now, importing from RSS is not as effective as importing from the endpoint because the RSS field, the formatting is a bit, mixed tax and categories are mixed. Okay. Yeah. Good. Yeah, good point.
Yeah. Yeah. That's annoying. Yeah, so because of that, I'm not importing categories and tax only the tile, the content and the excerpt, but, we do what we can.
[00:45:22] Nathan Wrigley: Yeah. Yeah, you've got some limitations there and, it's fine. We'll forgive you. Thank you,
[00:45:28] Leo Losoviz: Nathan. yeah. You're welcome. And finally, next one, importing from A-C-S-V-C-S-V, like Google Sheets.
Okay. If you, have Google Sheets, you can export A CSV and then you can import from CSV. So I'm going to the most, demonstrate. Now I have a CSV here. Once again, very
[00:45:44] Nathan Wrigley: well prepared.
[00:45:45] Leo Losoviz: Look at you. Yeah. Except when I innovate. So I have a CSV here. Okay, there it is. Here it is. It has a column, tile excerpt content.
Okay. And author. Okay. I have three post multichannel optimal interface, ergonomic motivating parallelism.
[00:46:10] Nathan Wrigley: Wow. Okay. Down downside solution's. Good time reading.
[00:46:17] Leo Losoviz: So I'm going to copy this. CRL, we go to the recipe import post from CSV. Here you can indicate which are the columns on the CSV file. So for the tile, it's called tile for the excerpt. It's called excerpt. Yep. So you can actually provide a different mapping. And then finally I provide the URL, which is that CSV.
And when I run this,
let's see. Back to the post.
[00:46:51] Nathan Wrigley: Let's see if we've got those fun titles to read. Here we go. Here we go. There they are
[00:46:58] Leo Losoviz: debating parallelism. Yeah. yeah. And yeah, it has imported them. There we are. Oh,
[00:47:05] Nathan Wrigley: they're so disappointingly short. I was hoping for pages.
[00:47:09] Leo Losoviz: Yeah, because that's what it was.
That one is.
An image with, and a link. A little link with image. The image doesn't exist. this image? Yeah. Yeah.
[00:47:23] Nathan Wrigley: My site.com. Com. Yeah. Yeah. Who? Yeah.
[00:47:26] Leo Losoviz: So yeah. okay, we're done with this one. And they want more, which is the opposite, which is exporting. So now what I can do is from my site, I export my content into your site.
Okay. Like the opposite of importing. let's do that one. I'm with you. Export, what was it called? Oh, export Here is, so this one, it requires the, slag. that's what we did before. So we have to have a slag to say, I will export my post, which has this slag. let's get one to here. No. It's a different one. So post or maybe one of the, new ones. Let's just publish this one and get the slide from this one.
Okay.
Okay. So I. Post Slack. Okay. I want this one then I want, so we aware. I'm going to copy it. So here I need, oh, I need to change something here. So basically here I need to enable an endpoint. Okay.
[00:48:54] Nathan Wrigley: In the plugin. Got it.
[00:48:56] Leo Losoviz: a custom endpoint in the plugin that I have already created it, it's called nester mutations, but it's private because if private is not accessible to the wall, actually, I'm going to run this first.
And I'm going to show you how it fails. View endpoint. So here is the endpoint. I just copy this URL from the endpoint on the site,
and then I will also need the username and password. Okay. Makes sense. Because I'm going to post, I'm going to create content there. Yeah. So here when I'm importing content, I don't need this because I'm creating content on my side, but now I'm creating content on your site. Yeah. Makes so, makes sense.
I need the cred. I need something there. yeah. So let's go to the users, because I don't know. And let's get any of these, maybe this CS Forest.
Username, CS, forest and password. Let's just create a new password.
Yeah.
Okay. got it. Was there anything else? Oh, update. Okay. No new. okay. I will run this now. And it gave me an error basically saying they know, endpoint. And that's because once again, the endpoint here is private. So let's change this. Let's make it public. Got it. So now this endpoint is connected to the world and I run this.
And now if we go error. Okay, so let's see, we go to the post here. Here we are. There. There
[00:50:45] Nathan Wrigley: it's a yay, yay.
[00:50:49] Leo Losoviz: Again, that is
[00:50:53] Nathan Wrigley: really clever. Like honestly, if anybody's watching this and they're thinking, yeah, No, that's all very clever stuff that Leo showed us there. That's remarkably cool. So you can import tons of content from another website into your website.
You can export stuff from your website into another website. You can duplicate posts, you can duplicate the entire contents of a post, especially. Did we get to see the classic editor one? Did you skip that
[00:51:21] Leo Losoviz: one? Oh, no. yeah, we can do it now. Okay. yeah,
[00:51:24] Nathan Wrigley: to say that you can do the, you can do, the formatting on a block, the.
All of the styling that goes with it will get thrown across as well. Click of a button. Okay, so here's the, here's the equivalent with the custom. Sorry. Here's the equivalent with the classic editor. It's a long time since I've seen the classic editor, ah, like an old friend. Here it
[00:51:44] Leo Losoviz: comes. I don't think I can translate this because how do, you translate Latin or whatever?
It's, who knows? Let's see. This one should be good. Two cities teaser. Let's go with that. Yeah. This one is classic editor, I think. This one is investigator. Yep. Let's just publish this. Converter blocks. No, uh, perfect teaser. Was it? I will need the id. Which one was it?
[00:52:08] Nathan Wrigley: it was teaser some. The top one. A Tale of Two Cities Teaser.
Oh. Here,
[00:52:12] Leo Losoviz: here we are. 14 14 79. 1 4 7 9. Yeah. Okay. What, language do you want? Oh,
[00:52:20] Nathan Wrigley: I don't know. pirate. Does it do pirate? Some of them do. anything you like? Let's go. What was it in? Yeah. French. Great. French. Perfect. We'll see the
[00:52:32] Leo Losoviz: change. Oh, and let's, just, I'll update it. Let's, go while on.
Okay.
[00:52:38] Nathan Wrigley: So you're gonna update the post, not.
[00:52:40] Leo Losoviz: Okay. Yeah, because I think I had it open, right? Yep. oh, actually no, I had closed, of two seaters series. Yeah, I refresh.
[00:52:52] Nathan Wrigley: Wow. It's true. It worked. Look at that The heck. And it's worked. And it's still inside the old classic editor. Yeah. Oh, Leo. My life is complete. I've, I've experienced something truly remarkable over the last 54 minutes. That is amazing. And even got yourself out of jail, you managed to fix a problem that you'd, you've made for yourself.
So just bravo.
[00:53:19] Leo Losoviz: No, to, to be honest. To be honest, I still need to back, I don't know what's going on there. I need to check, but you still need to, yeah. It, no, I know. You know what, it happens to me all the time. It happened to me this afternoon. Oh, I called something and I forget. I completely forget about it, and then I use it the wrong way and I spend 15 minutes debugging.
I'm like, this is working fine. You just need to. Add something else. You know it not good getting old. I'm telling you. Just try to avoid that if you can. If you can avoid getting old, do it because seen the brain stop working. have you seen this?
[00:53:54] Nathan Wrigley: Hair is the, this is the marker of getting old.
if you wanna watch what Leo has done in the past, if you've been intrigued by this and you wanna see what Leo's done in the past, quickest way to do that is just to go to wp build.com/demos archive. Over there, you're gonna see all of the different bits and pieces. This will. Probably go up there in, I don't know, within 24 hours, something like that.
I'll put it up there, but we're gonna be back. We're gonna be, actually, I've forgotten the date. Can you remember off the top of your head when the next date was? Lemme just have a calendar. Oh, okay. So six plus seven, you're right, it's 13. I can do basic maths. Yes. we'll be back on the 13th and in that episode we'll be going probably on what we thought we were gonna do, today.
So we'll be going, getting into now where have I put the Google doc? Can you remember what your topic was? Number three was gonna be, updating content in bulk and automating tasks. So I guess it made sense to do. This one first. Leo, absolute pleasure having you on today. I hope you enjoyed that. we'll be back this time next week.
Cheers, Leo. Thanks so much. Oh, where do people go to find out more about Gato?
[00:55:08] Leo Losoviz: GraphQL? Oh, gato graphql.com. There was a Yeah, just here. Here we are.
[00:55:17] Nathan Wrigley: Gato graphql.com. Go there, check it out. Enjoy the pictures of the cat. You've seen the real thing. Oh, we will be back. Yeah, it's still there. Lurking bring, here comes the cat.
Oh, a little bushy. Oh. And on that bombshell, we're gonna end it. Thank you so much, Leo. We'll see you next week. Take
[00:55:41] Leo Losoviz: it easy. Thank you. Thanks Nathan. Bye-Bye. Bye. Bye.
Supported by:

This series comprises the following episodes:
- Introduction, Running Queries in the Admin, Creating API Endpoints, Access Control, Caching - 18th October 2023
- Integrating with Gutenberg, Customizing content for users, Duplicating posts - 26th October 2023
- Translating content, Interacting with external services, importing / distributing content - 6th December 2023
- Updating content in bulk, Automating tasks - 20th December 2023
- Extending the GraphQL schema - 10th Jan 2024
Discover more from WP Builds
Subscribe to get the latest posts sent to your email.

Please leave a comment…