Next.js Tutorial - How to Fetch Posts from WordPress GraphQL API [part 7]

  Рет қаралды 7,487

Coding Reflections

Coding Reflections

Күн бұрын

This video is a part of the series where we're building a headless WordPress blog with Next.js. In this video, you'll learn how to query the WordPress GraphQL API to fetch the posts, then display on the frontend using Next.js.
Donations: you can support this channel by buying me a coffee:
ko-fi.com/abhi...
Repo: github.com/iab...
Website: www.coralnodes...
---------------------------------------
Server providers:
Linode: www.coralnodes...
DigitalOcean: www.coralnodes...
-------------------------------------------------------------
Disclaimer:
This video is based on my personal experiences and knowledge. There is no guarantee that the information shared is 100% accurate.
Disclosure:
This video and its description may contain affiliate links, which can earn us commission if someone purchases products using those links.

Пікірлер: 32
@sunjayarmstead
@sunjayarmstead Жыл бұрын
Thank you so much for this video / series! Very easy to follow and extremely informative.
@World_ofKnowledge
@World_ofKnowledge 24 күн бұрын
beset tutorial so far, please update with news version
@djortdelladjort
@djortdelladjort Жыл бұрын
Wonderful explanation. Easy to follow along
@davidessien3617
@davidessien3617 Жыл бұрын
Hi @CodingReflections This is the most straightforward video on this topic I have seen so far. I have been trying to get this right since last year, but nothing was making sense to me. You just made everything clear. Thank you. Is it possible for you to do this with Typescript and maybe the code gen? That would really be helpful.
@SherwinAnos
@SherwinAnos Жыл бұрын
Awesome bro, thanks for the tutorial :)
@shinyu140
@shinyu140 Жыл бұрын
Thank You For Tutorial 🥰
Жыл бұрын
Thanks for the videos, helped me alot ♥
@bielzgyn
@bielzgyn Жыл бұрын
Thanks for the video. How would it be with pagination? 🤔
@CodingReflections
@CodingReflections Жыл бұрын
Pagination video already in the queue. Scheduled for Feb 6, part 13.
@n3cro2012
@n3cro2012 Жыл бұрын
Thanks for the video update. What window manager do you use?
@CodingReflections
@CodingReflections Жыл бұрын
It's Ubuntu 22.04. I screen record the second monitor. That's why the top bar and dock panel are not seen in the video.
@hatempire
@hatempire Жыл бұрын
Thank you so mu h for this tutorial, exactly what I was needing to study some specific NextJS stuff alongside with WordPress! 😄 Suggestion: saw the overview video and it didn't include the comment section, using mutation and other stuff needed. Saw very few videos showing it, but solely outside WordPress (with Apollo and other CMS (GraphCMS, for example), which made me a bit confusing about how to apply it using WPGraphQL)... nothing about comments with WPGraphQL at all. Would you consider adding it to the final product, please? Already read the documentation, but had a tough time trying to make it work. :( Thank you so much in advance!
@CodingReflections
@CodingReflections Жыл бұрын
Sure, I'll try to figure out how to implement WordPress comments in Next.js. As you said, it requires authentication and mutation because we need to write data into the wp database. I plan to keep adding more videos to the playlist, beyond what was shown in the overview video. Thank you!
@hatempire
@hatempire Жыл бұрын
@@CodingReflections thank you so much, it'll be extremely helpful (and kinda unique, since the WPGraphQL implementations I saw on KZbin until now lack this part, what I saw about mutation had more to do with e-commerce, not comment sections... surely, it will be helpful for more people dealing with it).
@borisbarzotto5785
@borisbarzotto5785 Жыл бұрын
Hi @CodingReflections how i can get the featured image in original quality? whats the setting for that, i only get a sourset of bad quality images, you can get a good image in node position [0], i get a random set of images and different sizes, random order too
@HuxlygerardSingh
@HuxlygerardSingh Жыл бұрын
Please update the next video waiting eagerly for it
@CodingReflections
@CodingReflections Жыл бұрын
Of course, on the way!
@jyotichabba1487
@jyotichabba1487 Жыл бұрын
Hi @codeReflections graphql is not fetching all posts. Is there anything we can modify?
@PratikVishwakarma-h8s
@PratikVishwakarma-h8s Жыл бұрын
graphl me cursor ke through new next js docs pr kese pagiantion banye
@LalitKumar-ho4hq
@LalitKumar-ho4hq Жыл бұрын
Hello sir I am getting undefined while fetching the data and also in the postman I am getting a cloud agent error. Is there anything I need to enable in the wordpress. I would massively appreciate it if you could help me with this. Thanks
@CodingReflections
@CodingReflections Жыл бұрын
Where is the WordPress site hosted? Local or remote? Is the /graphql endpoint visible from the browser? What is the query which returned the undefined error? Can you give more details?
@matthewaraujo7361
@matthewaraujo7361 Жыл бұрын
@@CodingReflections i'm facing the same error, my Wordpress is local, i don't know if the browsers can se my endpoint, and my error says :The requested URL was not found on this server.
@kavinduliyanaarachchi99
@kavinduliyanaarachchi99 2 ай бұрын
Can anybody help me with this error "TypeError: Cannot read properties of undefined (reading 'nodes')"
@МарияТроянова-г1и
@МарияТроянова-г1и Жыл бұрын
graphics-ide does not load, an error appears in the console. "Uncaught (in promise) GraphQLError: Names must only contain [_a-zA-Z0-9] but "Template_An empty "does not." Please help me solve this error
@CodingReflections
@CodingReflections Жыл бұрын
Can you mention the video timestamp at which the error occurred? Also, is it the WP backend, or in the Nextjs site?
@МарияТроянова-г1и
@МарияТроянова-г1и Жыл бұрын
@@CodingReflections This happened to me when I installed the Wp GraphQL plugin. For some reason, graphiql-ide does not want to work with me, there is an eternal download
@МарияТроянова-г1и
@МарияТроянова-г1и Жыл бұрын
@@CodingReflections problem when installing the WPGraphQL plugin. graphics-ide does not load anything, and there is an endless loading
@CodingReflections
@CodingReflections Жыл бұрын
Looks like currently there is some issue with the WordPress plugins directory. WPGraphQL is not showing up when searched from the Add Plugins page, but can be downloaded directly. Here are a couple of things you might want to check: 1) Try downloading it directly from wordpress.org/plugins/wp-graphql/ ? It is working for me and the GraphiQL IDE is loading without issues. 2) Note that the current WordPress version is 6.1.1 & WPGraphQL is 1.14.0. 3) Also, are you trying it on localhost, or on a remote server? You can check the browser's Networks tab to find out which resource is preventing the download. Maybe, try a different browser. 4) Do you have any other conflicting plugins installed? Try on a fresh WP installation.
@МарияТроянова-г1и
@МарияТроянова-г1и Жыл бұрын
@@CodingReflections the problem was solved by installing an older version of the plugin. Although I have wordpress 6.1
@wheezetv3861
@wheezetv3861 Жыл бұрын
my solution: stack: wpgraphql 1.14.3, wordpress 6.2 next 13.3 page/blog: const [posts, setPosts] = useState(); useEffect(() => { async function getPosts() { const response = await fetch("localhost/wp-blogwithnext/graphql", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(queryAllPost), }); const data = await response.json(); setPosts(data); } getPosts(); }, []); // This would be the children of the page blog posts.js: export const queryAllPost = { query: ` query getShort { posts { nodes { date slug title excerpt } } } `, };
@matthewaraujo7361
@matthewaraujo7361 Жыл бұрын
how did you make your request, I'm using local too and im getting this error: "The requested URL was not found on this server". I did everything in that video but i keep getting the same error always
How to Convert Date Strings in Next.js / React - Next.js + WP [part 8]
7:36
Implementing Pagination (Load More Button) in a Next.js Blog [part 13]
25:27
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 3 МЛН
Who's spending her birthday with Harley Quinn on halloween?#Harley Quinn #joker
01:00
Harley Quinn with the Joker
Рет қаралды 20 МЛН
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 2,7 МЛН
Pages Router vs App Router in Next.js - Key Differences
12:24
Coding Reflections
Рет қаралды 9 М.
Form handling in Next.js - Headless WP + Next.js Blog [part 12]
24:48
Coding Reflections
Рет қаралды 1,3 М.
Integrating Yoast SEO with Next.js Headless WordPress [part 20]
16:54
Coding Reflections
Рет қаралды 2,3 М.
How to add Google fonts in Next.js - Next.js + Headless WP [part 19]
13:10
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 3 МЛН