WordPress Custom Loop WP_Query Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ธ.ค. 2024
  • Join my 2024 Complete WordPress Course here learnwebcode.t...
    Learn about WP_Query and create custom loops in any WordPress theme file.
    My recommendation to host your WordPress website is DreamHost (I've used them for 19 years). If you use my link to DreamHost it helps support my TH-cam channel click.dreamhost...
    To learn about everything that WP_Query is capable of check out the official WordPress documentation: codex.wordpress...
    Link to download .zip of theme files as shown in this video (note: this is not a "complete" WordPress theme yet and this download is only intended for educational purposes to dissect and review):
    learnwebcode.co...
    To view a complete list of the WordPress lessons in sequential order visit:
    learnwebcode.co...
    Sign up for my newsletter to receive periodic webDev tips, tricks, resources and coupons. Join the list at learnwebcode.com/
    Follow me on Twitter for updates and cat pics:
    / learnwebcode

ความคิดเห็น • 141

  • @LearnWebCode
    @LearnWebCode  หลายเดือนก่อน

    I can't believe this series is 10 years old. While a lot has changed in WordPress over the years the core concepts remain the same and I hope this series is helpful in your learning journey. For anyone who is curious, my recommendation for hosting your WordPress website is DreamHost and specifically their "Shared Unlimited" yearly plan (the exact plan I've used for 19 years). If you use my link to DreamHost it helps support my TH-cam channel and costs you nothing extra: click.dreamhost.com/aff_c?offer_id=109&aff_id=17231

  • @mananazam1800
    @mananazam1800 ปีที่แล้ว +1

    even after 9 year this course is very helpful recommended

  • @benlowrey
    @benlowrey 4 ปีที่แล้ว

    You give the clearest explanations I’ve ever heard. You are a really good teacher.

  • @thomasalston
    @thomasalston 7 ปีที่แล้ว

    Your commentary as you go through the code really is helpful. Looking forward to going through more of your videos. Thanks :)

  • @francescafontana4620
    @francescafontana4620 8 ปีที่แล้ว +1

    I so wanna say thank you!
    I knew literally NOTHING about html, php and css till a week ago and now i actually am able to do sooooo much!!
    Your explanations are perfect and these videos are just so well made.
    thank you again.

  • @johnconnolly9969
    @johnconnolly9969 3 ปีที่แล้ว

    I could kiss you right now. I’ve struggled with this for days and you’ve solved it for me. Thank you!

  • @peterc5171
    @peterc5171 10 ปีที่แล้ว +6

    I have looked through a lot of tutorials through the web and here on TH-cam. I have to say that your lessons are just about the best I have come across! They are clear, simple, informative, and have a purpose and real world outcome. Please keep going.

  • @BBDDSAL
    @BBDDSAL 9 ปีที่แล้ว +2

    Great tutorial. By far one of the best WP I've encountered on TH-cam.

  • @gamermeshie3180
    @gamermeshie3180 7 ปีที่แล้ว

    Your lessons are better than my instructor. It is easier to understand and absorb, especially for beginners. Keep it up! :)

  • @michaeloliver6745
    @michaeloliver6745 9 ปีที่แล้ว +2

    Guy is insane how much he knows!! Will I ever get THAT good!? Awesome stuff!!

  • @ameer23ful
    @ameer23ful 8 ปีที่แล้ว +6

    At the end of this tutorial, I just wanna say;
    Man you are awesome.
    Thank you very much,

  • @mathijs2100
    @mathijs2100 10 ปีที่แล้ว +2

    Hoping you'll keep going with this series, it's really one of the best teaching I've seen on here.

  • @bikashgurung193
    @bikashgurung193 6 ปีที่แล้ว

    i found a great teacher brad. Please make some more courses

  • @2010Tane4ka
    @2010Tane4ka 6 ปีที่แล้ว

    I can't Englisch but you make it so understandable. ... It's really cool, I come forward. Thank you so much!!

  • @isunas16
    @isunas16 9 ปีที่แล้ว

    I hope u feel like u learned something.....YES!I've learned sooooo many things.Thank u so much bro

  • @ofuezuemlynus2965
    @ofuezuemlynus2965 10 ปีที่แล้ว +5

    you are the best wordpress teacher.....thanks alot

  • @codechamp2599
    @codechamp2599 7 ปีที่แล้ว

    this tutorial is sitll saving lifes of many programmers Thanks sir

  • @furqanajmal6686
    @furqanajmal6686 4 ปีที่แล้ว

    Thank you so much for these wonderful tutorials.
    You are an extraordinary teacher. Thanks again!

  • @zambo1511
    @zambo1511 6 ปีที่แล้ว

    You are the ruler God of TH-cam.

  • @alexdewilde934
    @alexdewilde934 6 ปีที่แล้ว

    Damn live the way you speak, sounds passionate and makes it easy to understand. And u where correct about the aha moment. Working with query's is really easy with a good explanation

  • @marklozano9898
    @marklozano9898 10 ปีที่แล้ว +1

    Just finished watching all of your videos while following along on coding. Great tutorial, very detailed. Best tutorial of wordpress theme creation that I have watched. Thank you sir! I will surely tell everyone who wants to learn wordpress about your tutorial course here and on udemy. Hope you upload more videos about wordpress! I will surely wait for that. :)
    just one question about this video. you mentioned about the wp_query class and its objects, is that what they call OOP on PHP?
    if it isnt can you please create a tutorial on how to do OOP on PHP, so We can kinda sort and organized the functions through classes? I have watched some videos about that but its not clear, unlike you do. you go step by step and willing to teach and share your knowledge for everybody, not just about getting subscribers and views. your a great teacher. Thank's again! :)

  • @jaysonlauza5850
    @jaysonlauza5850 10 ปีที่แล้ว

    One of the best tutorials I watched!

  • @OliverWoodphotography
    @OliverWoodphotography 6 ปีที่แล้ว

    Thanks for these really clear easy to understand tutorials.

  • @rajathveeramanchala
    @rajathveeramanchala 8 ปีที่แล้ว

    Hello, First of all i would like to thank you a lot for this wordpress theme development playlist. You deserve a good appreciation and respect for helping many beginner developers. I have developed a theme for my own sports website by learning from your tutorials. But i would like to suggest you to add videos on making the theme responsive and on adding page links(useful to see old posts when limited to 5 posts per each page). I have searched from various sources and completed my theme. I`m just suggesting so that it would be helpful for those who follow this playlist in future. Once again THANK YOU !!

  • @AmitGupta-ck5tj
    @AmitGupta-ck5tj 7 ปีที่แล้ว

    sir I am from India , your videos is so good for WordPress developer, sir can you plz make complete videos about WordPress database such that , how to use wp_postmeta value on front end , what is wp_post table field , what is wp_terms in WordPress , how to use WordPress custom database . as well as everything related WordPress database . sir plz make a video plz , your videos is very helpful for WordPress developer . thanks a lot for this video . keep it up sir .

  • @ManabuMiwa
    @ManabuMiwa 9 ปีที่แล้ว

    This is exactly what I had wanted to know for a long time. Thanks you for your great video!

  • @cervantes01
    @cervantes01 6 ปีที่แล้ว +1

    Love it, can we have more tutorials please!

  • @prasadchintala2525
    @prasadchintala2525 9 ปีที่แล้ว +14

    The way you are teaching is which is easy to understand, You r Super Bro,Thanq.

    • @LearnWebCode
      @LearnWebCode  9 ปีที่แล้ว +5

      Prasad Chintala Thanks so much! I'm glad the videos are helpful :)

  • @orochinagi1111
    @orochinagi1111 9 ปีที่แล้ว

    brilliant..! love the video sizes and your teaching style

  • @thewebproject
    @thewebproject 9 ปีที่แล้ว

    Thank you so much sir. Your vid lessons are the greatest videos here in youtube. God Bless you sir.

  • @andrewdeacon4384
    @andrewdeacon4384 10 ปีที่แล้ว +1

    Very clear explanation - excellent.

  • @turboromy
    @turboromy 7 ปีที่แล้ว

    I've been trying to do this "from 2 separate category" thing and been very frustrated. Now I got it. Thanks.

  • @UsmanAhmed714
    @UsmanAhmed714 2 ปีที่แล้ว

    one billion likes for this video and for the author.

  • @imfreeash
    @imfreeash 9 ปีที่แล้ว

    I learn a lot from your tutorial, thank you so much

  • @ankitagajjar5880
    @ankitagajjar5880 4 ปีที่แล้ว

    thank you, one of the best wordpress tutorial

  • @erichepperlewp
    @erichepperlewp 3 ปีที่แล้ว

    3:25 - Empty LOOP skeleton
    7:50 - Recent posts query order by asc

  • @againstthesystem83
    @againstthesystem83 9 ปีที่แล้ว

    Extremely useful tutorial. Thanks.

  • @rdagger
    @rdagger 10 ปีที่แล้ว

    Great job. It must have taken a lot of work to put together these tutorials in such a professional manner. Thanks.

  • @AssaultOuStudios
    @AssaultOuStudios 8 ปีที่แล้ว +1

    Just discovered these - they're great. Thanks for the effort.
    Will you by any chance at some point do a tutorial on creating your own widgets?

  • @mabrarhassan
    @mabrarhassan 9 ปีที่แล้ว +1

    Greatest among the teachers!!!

  • @arjangap2551
    @arjangap2551 5 ปีที่แล้ว

    Very good tutorial, It explained everythings i needed.

  • @sayedakbarali5650
    @sayedakbarali5650 10 ปีที่แล้ว +4

    Thank You Once Again for this Wonder full Series Really Appreciate it

  • @clearf1x
    @clearf1x 7 ปีที่แล้ว

    You are the best!
    Thanks for you tutorials! :)

  • @SandradeeVids
    @SandradeeVids 5 ปีที่แล้ว

    Your videos have been a tremendous help while building my first Wordpress theme. Thank you so much.

  • @PtxDK
    @PtxDK 8 ปีที่แล้ว +4

    0:20 Just before I started the video i had this feeling. :D

  • @ethantyler7374
    @ethantyler7374 5 ปีที่แล้ว

    its was my AHA moment i can confirm it. been scratching my head on another course where i was having hard time understanding the guy.

  • @mdmasud5888
    @mdmasud5888 8 ปีที่แล้ว

    It's amazing to me. I think i have learned so much things.

  • @RecomeR96
    @RecomeR96 8 ปีที่แล้ว

    You're just the best. Saving me. Thank you a lot!

  • @fengshuienthusiast7635
    @fengshuienthusiast7635 6 ปีที่แล้ว

    Intense, Rewarding, and Grateful.

  • @ironjebi999
    @ironjebi999 9 ปีที่แล้ว

    extremely useful, thanks for the tutoria. I'm trying to create a list of a specific post category that shows the reatured image on hover, any sugestion of how can I begin?

  • @mistermagnus1836
    @mistermagnus1836 10 ปีที่แล้ว +1

    Great tutorials! One question. When using wp-query on categories. Is there a way to allow the user to decide which category to put in the area instead of hardcoding the actual cat id? For instance, using this method, if you put cat=7, only category 7 will show in the area, is there a way to allow the user to change the category in the admin dashboard so if they want lets say "opinion" to show it will, or if they want to change it to "news" they can in admin dashboard? Only question I have, you covered everything else beautifully!!

    • @LearnWebCode
      @LearnWebCode  10 ปีที่แล้ว +2

      Erik Hals Ah, that is a great question. If you don't need to have fine grain control on the way the content is output you could use a widget which allows the end user in the dashboard to change the category. If we want to retain our 100% custom HTML output for the content I would say the best way to let the end user in the dashboard control the chosen category/categories would be to use custom fields. I will cover custom fields in the near future, but in the meantime if you are curious - Google "Advanced Custom Fields" which is a free and amazing plugin for WordPress that makes all sorts of things possible.

  • @mesumantandukar
    @mesumantandukar 10 ปีที่แล้ว

    Great tutorials.. Thanx a lot... :)

  • @RavenaciousTM
    @RavenaciousTM 8 ปีที่แล้ว

    Totally an Aha!-moment. Thank you, Sir!

  • @amitmoral
    @amitmoral 6 ปีที่แล้ว

    Great tutorial. How to display custom post loop using get category?

  • @ronniej446
    @ronniej446 10 ปีที่แล้ว

    simple but elegant

  • @xromium
    @xromium 8 ปีที่แล้ว

    Love your videos! Thanks a lot!

  • @handmadesoapbars
    @handmadesoapbars 9 ปีที่แล้ว

    Can you explain anything about Kirki wp customizer?

  • @hamzaeljaouhari5419
    @hamzaeljaouhari5419 6 ปีที่แล้ว

    I wish if the tutorial was long enough :D haahhaha Thanks a lot

  • @alexshooter5176
    @alexshooter5176 4 ปีที่แล้ว

    Woooow thanks a lot i was searching the same thing on TH-cam and google since One week that how can i show my custom post type data dynamically on wordpress page. I’m using elementor.
    Can i make the short code of same wp_query and can use that short code to the elementor. Shortcode ??

  • @servicesinformatique9498
    @servicesinformatique9498 5 ปีที่แล้ว

    thank you so much, this what i search :)

  • @dsulvadarius
    @dsulvadarius 9 ปีที่แล้ว +1

    i like the way you teach.

  • @PeterKirwan
    @PeterKirwan 6 ปีที่แล้ว

    You sir are a lifesaver!

  • @theislamic_messages_media6762
    @theislamic_messages_media6762 5 ปีที่แล้ว

    Hi sir the square thumbnail, displays the same image for opinion and for news part

  • @sidneysousa3520
    @sidneysousa3520 8 ปีที่แล้ว

    Really helpful tutorial and thanks a lot for it.
    How can I print the category name before printing the title of each post?

  • @askas0497
    @askas0497 8 ปีที่แล้ว

    thanks for tutorial before, but i have question , how you can make the button look like on the last minutes, can you make tutorial please??

  • @mohammedadlan
    @mohammedadlan 8 ปีที่แล้ว

    Great instructor
    thanx alot

  • @asdfkerub
    @asdfkerub 6 ปีที่แล้ว

    One question, What if you are trying to change the category of the wp_query on click? How would you re run and re populate the new wp_query? Thanks!!!!

  • @adriandc9
    @adriandc9 9 ปีที่แล้ว

    Hi Sir, thank you so much for this tutorials and I've learning a lot from this series. One question please, I would like to use wp_query in archive page, what if I would like to query all post from the current category of the archive page that for a specific tag? How can I code that? thank you so much

  • @Kodingi
    @Kodingi 9 ปีที่แล้ว

    Good series. Thanks!

  • @DrunkenShinobi
    @DrunkenShinobi 10 ปีที่แล้ว

    Is there a way to prevent copying content from a website with wordpress?

  • @ukvaishnav
    @ukvaishnav 7 ปีที่แล้ว

    how many wp_query in a single page? would this affect the performance?

  • @oliverfemi5955
    @oliverfemi5955 7 ปีที่แล้ว

    please can you do a video on list category plugin to display category and subcategory list on a page.

  • @charlesloehle7998
    @charlesloehle7998 8 ปีที่แล้ว

    How can i get atom editor to do that thing where you type two matching lines of code at the same time?

  • @decorazon2007
    @decorazon2007 7 ปีที่แล้ว

    Hi man.. that very great videos.. thanks a lot... hey i have a doubt: how i can combine 2 post types in one loop... ? example: players and soccer teams .. i wan to show only that players who play in first division teams.. teams category are first and second.. thanks again

  • @PanCakeMixer101
    @PanCakeMixer101 6 ปีที่แล้ว

    does this work on custom post types ?

  • @pama4546
    @pama4546 9 ปีที่แล้ว

    Great tuts dude :) ! Would be great if you create one for HTML into WP from scratch? Subscribed,thanks !

  • @pratyushranjan277
    @pratyushranjan277 8 ปีที่แล้ว +1

    the tutorial is damn good but which editor you are using??it's also cool..

    • @LearnWebCode
      @LearnWebCode  8 ปีที่แล้ว +3

      Thanks! I'm using "TextMate" in this video, but nowadays I use "Sublime Text" and also recommend Atom by GitHub.

    • @birsingh5388
      @birsingh5388 6 ปีที่แล้ว

      VS Code is also good :)

  • @omranabazeed
    @omranabazeed 9 ปีที่แล้ว

    thank brad really apreciate it dude

  • @allenliu1672
    @allenliu1672 8 ปีที่แล้ว

    Nice text editor, good for identifying php code. Could u tell us the name?

  • @rahilarious
    @rahilarious 4 ปีที่แล้ว

    What if we want 2 columns for same loop? (For blog posts/home)

  • @Greg4510able
    @Greg4510able 9 ปีที่แล้ว

    wow,
    you saved my night

  • @jellycoding
    @jellycoding 7 ปีที่แล้ว

    Great tutorial. However I have a question. If I make a theme and give it to someone else. How do I know that the Opinion category is going to have the same ID in his installation?

    • @gamermeshie3180
      @gamermeshie3180 7 ปีที่แล้ว

      Let me try to answer this question. If you are trying to give your theme or transfer it to someone, you need to be able to properly execute the transfer of the theme . See this link for more info: www.wpbeginner.com/beginners-guide/how-to-properly-switch-wordpress-themes-on-your-site/

  • @pedroantunes7773
    @pedroantunes7773 8 ปีที่แล้ว

    Hey! I know this is an old video but I was wondering... could I create 2 different templates for those 2 columns and then call them with get_template_part? If I have my homepage structured with 6 rows, each with a different loop, wouldn that output a "cleaner" code? Is there any advantage or this just doesnt makes sense? Thanks!

  • @wirelessexpo7593
    @wirelessexpo7593 10 ปีที่แล้ว

    How do you compile it to upload online?

  •  9 ปีที่แล้ว

    Great tutorial.I like it.tks :*

  • @pilifernandez-davila1166
    @pilifernandez-davila1166 7 ปีที่แล้ว

    Great tutorial!!!

  • @majdalyousfi8867
    @majdalyousfi8867 7 ปีที่แล้ว

    Great tutorial Thanks

  • @J4si3k1992
    @J4si3k1992 8 ปีที่แล้ว

    Nice tutorial, but I have one question. How to make one loop with custom post type (category) and normal category? How to make all in one loop?

  • @jjblueflame
    @jjblueflame 7 ปีที่แล้ว

    Simply great tut!

  • @Badboyifier
    @Badboyifier 8 ปีที่แล้ว

    I used your code, deleted the wp_reset_postdata(); and nothing changed, can you explain it briefly why and whats the purpose of it?

  • @missyani7003
    @missyani7003 9 ปีที่แล้ว +5

    I OWE MY LIFE TO YOU LOL

  • @jyotibarasker2792
    @jyotibarasker2792 7 ปีที่แล้ว

    Sir you had not shared the video for creating content-single and content-page.php in your theme

  • @AmitGupta-ck5tj
    @AmitGupta-ck5tj 7 ปีที่แล้ว

    very nice videos sir

  • @shadab677
    @shadab677 7 ปีที่แล้ว

    sir how to change wp_query post width in 3 to 4 column it displays only 100% size

  • @256k_
    @256k_ 8 ปีที่แล้ว

    I'm finding myself in a pickle... not sure why this is happening... i'm working on my homepage (front-page.php) i designed it to be a 3 block scrollereach block i show the last few posts from a category.
    I followed your video and i manage to get the outputs properly but i've noticed that the html page doesnt load the rest of the html after the loop!
    Not sure why that is....

  • @kiranmulmi7405
    @kiranmulmi7405 8 ปีที่แล้ว

    amazing tutorial

  • @yashpatel-lu5bm
    @yashpatel-lu5bm 4 ปีที่แล้ว

    plzz use "what template i am view" plugin in word press to see the page will called
    like themes/index.php
    themes/page.php
    it will easy for beginner that will page will called

  • @mohamedobeidalla6659
    @mohamedobeidalla6659 9 ปีที่แล้ว

    thank you very very helpful

  • @parthcreative
    @parthcreative 6 ปีที่แล้ว

    how can I add pagination in this custom loop

  • @saikatnaskar5047
    @saikatnaskar5047 4 ปีที่แล้ว

    sir fatal error , Fatal error: Call to undefined function have_posts() how to solve?