Custom Queries In WordPress

  Рет қаралды 19,800

WPCasts

WPCasts

3 жыл бұрын

In this video, we go over how to create a custom query in #WordPress using WP_Query, get_posts, and $wpdb.
WPScan: wordpress.org/plugins/wpscan/
Code: gist.github.com/alexander-you...
💖 Become a Patron to show support & get perks!
/ wpcasts
Sign up for the newsletter. Free course coming in 2020:
wpcasts.tv
*SOCIAL*
Twitter: / alexanderbyoung
Facebook: / wpcasts.tv

Пікірлер: 57
@KurtBunch619
@KurtBunch619 3 жыл бұрын
Love your tuts as always. Would love to see more on how to build this out with a featured image, excerpt, title, metadata and read more link.
@jlambert12013
@jlambert12013 2 жыл бұрын
My mind is blown. This is so much easier than what I have been doing. Thank You.
@christopherjschultz
@christopherjschultz 3 жыл бұрын
This is very clean and well put together. I love watching your videos. Thanks for the Tutorials!
@WPCasts
@WPCasts 3 жыл бұрын
Glad you like them!
@qber83
@qber83 3 жыл бұрын
You made this very easy to follow and extremely helpful. Top notch content as always!!! Would love to see a tutorial on the best way to access post content outside of the loop.
@nicolaskeith8872
@nicolaskeith8872 3 жыл бұрын
Alex, these videos are great, thanks for doing them. Would really like to see more ways of using custom fields.
@WPCasts
@WPCasts 3 жыл бұрын
More to come!
@TubeTester6006
@TubeTester6006 Жыл бұрын
Newbie here. Thanks to WPCasts for this video. Can I ask some of the experienced WP coders 1) Why is this code happening in a theme in index.html? What if I want to put a custom query on a page in my current site using my current theme? 2) If I am following this tutorial to the letter and coding not on my local computer but on a dev WP website, how can I view the page? What URL should I use?
@billwoods4935
@billwoods4935 3 жыл бұрын
Very nice tutorial on getting the data FROM the database! Thank you! It'd be super cool to see a complementary tutorial on custom queries TO the database (i.e. insert/update data to the database). Thanks!
@aktaruzzaman849
@aktaruzzaman849 3 жыл бұрын
All of your tuts are really good. Thank you!
@WPCasts
@WPCasts 3 жыл бұрын
Glad you think so!
@saidsel-lam2300
@saidsel-lam2300 2 жыл бұрын
I discovered you today and feel like christmas came early this year
@Allformyequine
@Allformyequine 3 жыл бұрын
A great resource on queries thank you!!
@WPCasts
@WPCasts 3 жыл бұрын
Glad it was helpful!
@nnivxix
@nnivxix Жыл бұрын
6:10 WP_Query is good way to filter the post. thanks, you save my life.
@vitughost6778
@vitughost6778 3 жыл бұрын
Please make a complete ecommerc project with ACF and CPT(by coding)
@PrzyjacielKamil
@PrzyjacielKamil 3 жыл бұрын
Great topic, hope there will be video with more advanced examples.
@shaneblackwoodGodbless
@shaneblackwoodGodbless 3 жыл бұрын
Much love man great content
@nicolaskeith8872
@nicolaskeith8872 3 жыл бұрын
Another tutorial idea could be how to setup WP with TailwindCSS 2.0
@noise8653
@noise8653 3 жыл бұрын
Amazing! Thank you very much!!
@TheProDat
@TheProDat 3 жыл бұрын
Thanks for the tutorials. Please make a video on filtering posts using ACF field's plus AJAX.
@WPCasts
@WPCasts 3 жыл бұрын
Noted!
@primewholeness
@primewholeness 2 жыл бұрын
I was messing around with the Query Loop Block with some CPTUI pages and accompanying taxonomies (cats and tags both)... I finally realized , I think, hat the Query Loop Block will not make use of those custom taxonomies...shrug. I can chose the Custon post type, but not any of the categories or tags that go with that CPT as you see under Posts...(or I still don't have CPTUI settings correct yet) That's how I ended up here on your video...So thanks! I know I can do that if I really must have it..:)
@premdaryanani422
@premdaryanani422 2 жыл бұрын
Hey thanks a lot for your content. If you have a vid on how to paginate these posts with and without ajax please do share the link, thanks.
@MobiusCoin
@MobiusCoin 3 жыл бұрын
Hey Alex! Can you show us your CORS configuration sometime?
@kellenmace
@kellenmace 3 жыл бұрын
Great overview of ways to query for posts 👍🏼
@WPCasts
@WPCasts 3 жыл бұрын
Thanks, Kellen! Love your work, btw!
@kellenmace
@kellenmace 3 жыл бұрын
@@WPCasts Thanks! Likewise! 😄
@ozgrymn
@ozgrymn 3 жыл бұрын
Thanks for the tutorial, which font do you use in VS code, could you tell please?
@TJKhara
@TJKhara 3 жыл бұрын
Great video thanks
@WPCasts
@WPCasts 3 жыл бұрын
No problem 👍
@InHouse-Tech
@InHouse-Tech 3 жыл бұрын
Life saver
@BucurIonNiculae
@BucurIonNiculae 3 жыл бұрын
Nice job.
@WPCasts
@WPCasts 3 жыл бұрын
Thanks!
@rabinawale4526
@rabinawale4526 3 жыл бұрын
my question among this three which is best way to query that is more efficent and that you recommend.... like for fast loading of data
@WPCasts
@WPCasts 3 жыл бұрын
I believe that $wpdb can be the fastest since you have more control over the query and less overhead. But I'm not 100% sure. I'll have to test it out!
@SimonDaviesOfCourse
@SimonDaviesOfCourse 3 жыл бұрын
@@WPCasts I would agree, by reducing down what your requesting, to what you actually need is faster on the SQL end, so if your making a listing page and just need title, link, image then just asking for those would be better than returning the whole post content. Hope this makes sense, so $wpdb with a bespoke select query would be better. Great video on the ways to do it though as well 👌
@obiesilva709
@obiesilva709 2 жыл бұрын
I have a client website where I have a custom post type I created called “Events”. I have a few ACF fields inside of that CPT. On the home page I would like to display two of those events at a given time but need to let the user pick which events they need. I’m able to do just that, however the ACF fields don’t display everything else does. Is there a way to get the ACF fields to display on any given page from a CPT?
@ArifBillahOnGoogle
@ArifBillahOnGoogle 2 жыл бұрын
You missed mentioning something very important, does the wpdb class use prepared statements?
@toptrendstv
@toptrendstv 2 жыл бұрын
Hello, help me on how I can query posts using wp_query, and showing posts by views. I use jetpack views stats and that's what I want to use. I learnt a lot from this video though.
@JimKernix
@JimKernix 3 жыл бұрын
You only used wp_reset_postdata for get_posts - should you reset the post data after each method?
@jagansaran5195
@jagansaran5195 2 жыл бұрын
Hi I need add to cart button click function customization?
@NagatoKamiPain
@NagatoKamiPain 6 ай бұрын
how can I handle pagination when using wpdb->get_results ?
@lekkyjayz6294
@lekkyjayz6294 3 жыл бұрын
Don't you have to reset the post-data after using WP_Query()?
@zomalee4512
@zomalee4512 3 жыл бұрын
Custom search page tutorial 😀
@premnathd
@premnathd 3 жыл бұрын
Yes, need rendering tutorial
@WPCasts
@WPCasts 3 жыл бұрын
You got it!
@premnathd
@premnathd 3 жыл бұрын
@@WPCasts thank you. Many ways are there.. confusing for me. Explain us like this one. This video gives me clarity on custom queries
@SuperRockcore
@SuperRockcore 8 ай бұрын
Bro, I am trying to get posts to display by page. Like I got an "author's" page (actually teacher's) and I want that page to be theirs, so that only the posts they wrote will display. I've been looking for hours on how to do this simple thing. Is it just like beyond wordpress's capabilities?
@JimKernix
@JimKernix 3 жыл бұрын
Do you have any videos on how to get custom post types to appear in the main blog roll or other archive pages? I'm a newbie and just built a theme using _s and am working on a CPT that I created using mu-plugins folder and register_post_type. When I click on the tags ot category tied to my CPT the articles from that CPT do not show. SAme with searching, though if I search a keyword in one of the titles, then that will return posts in my CPT. Either I missed something simple or I have to do something with the REST API which I do have show_in_rest set to true in the file where I registered it. If you don't have a video, any websites or articles that cover it?
@JimKernix
@JimKernix 3 жыл бұрын
Also, I'm not getting what you are getting from the pre tags - I'm getting the content but not the featured images and for WP_Query no SQL stuff or anything near what your output is.
@JimKernix
@JimKernix 3 жыл бұрын
NEVERMIND - didn't change $posts to $query in the print_r function - total newbie here - still not getting the thumbnail though
@JimKernix
@JimKernix 3 жыл бұрын
I'm not doing well - for $wpdb I had my CTP output the same posts multiple times but that didn't happen when I chose 'post'...
@doni654321
@doni654321 Жыл бұрын
I really need help urgent
What To Learn In 2021 With WordPress
13:44
WPCasts
Рет қаралды 8 М.
Introduction to JavaScript in WordPress
19:50
WPCasts
Рет қаралды 20 М.
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 143 МЛН
Can You Draw A PERFECTLY Dotted Line?
00:55
Stokes Twins
Рет қаралды 75 МЛН
Create Custom User Capabilities in WordPress
12:50
WPCasts
Рет қаралды 11 М.
How to Write a Custom Query in WordPress
19:59
mrknowitall
Рет қаралды 1,5 М.
WordPress - WP Query
15:51
Chris Miller
Рет қаралды 1,1 М.
Wordpress Hooks (Actions & Filters) Explained
22:43
HowToDev
Рет қаралды 4,3 М.
3 Methods for AJAX in WordPress | Which Method is the Best?
23:09
💅🏻Айфон vs Андроид🤮
0:20
Бутылочка
Рет қаралды 740 М.
Best mobile of all time💥🗿 [Troll Face]
0:24
Special SHNTY 2.0
Рет қаралды 972 М.
#miniphone
0:16
Miniphone
Рет қаралды 3,6 МЛН