HomeОбразованиеRelated VideosMore From: LearnWebCode

WordPress get_template_part Tutorial

598 ratings | 82668 views
My new advanced WordPress course: https://www.udemy.com/become-a-wordpress-developer-php-javascript/?couponCode=YOUTUBEDEAL My new beginner WordPress course: https://www.udemy.com/wordpress-for-beginners-create-a-website-blog-step-by-step/?couponCode=YOUTUBEDEAL In this lesson we learn how to use the "get_template_part()" function to avoid repeating code throughout our theme files. To view a complete list of the WordPress lessons in sequential order visit: http://learnwebcode.com/learn-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): http://learnwebcode.com/wordpress-get_template_part-theme-development-tutorial/ Sign up for my newsletter to receive periodic webDev tips, tricks, resources and coupons. Join the list at http://learnwebcode.com/ Follow me on Twitter for updates and cat pics: https://twitter.com/learnwebcode
Html code for embedding videos on your blog
Text Comments (44)
Vishal Jain (6 months ago)
can you please tell me after maked custom theme how we gave updates to our users how they will be notify how they got the message of updates on dasboard please please please you use wordpress 12 years so please tell me sir
Yasir Khaskheli (8 months ago)
first toturials that understand clearly thanku sir you teach me better
Efrain Lemus (8 months ago)
This was by far the hardest video in this series so far, at least for me. I just couldn't get around adding and moving the code around in the content.php
Anmol Raj (1 year ago)
i'm getting this issue anyone know how to fix this? getTemplate was called incorrectly <<<<,-----------------------------
Ray Nicol (1 year ago)
Excellent series of tutorials. Interesting, useful and well presented. Given me the direction I needed. Keep up the good work.
patrick nwakwoke (1 year ago)
Just going through your tutorial. Great stuff. Modified my content.php to use this instead. if($post->post_excerpt || is_search()){ ?> <p><?php echo get_the_excerpt(); ?> <a href="<?php the_permalink()?>">Read More &raquo;</a> </p> <?php } else { the_content(); } ?>
Abid Younas (1 year ago)
thumbs up for your every tutorial Thanks LearnWebCode
Cameron Ratcliff (2 years ago)
You the shit bruh
STRONG EAGLE (2 years ago)
you have not added it to category.php (but added in archive) but exhibition it on video in the website xd
STRONG EAGLE (2 years ago)
or I'm sleepy
Samiron Barai (2 years ago)
done :)
Arman Masangkay (3 years ago)
This is a really good tutorial. Keep it up!
Darren Bachan (3 years ago)
What about your single.php, the only thing different was the link on the article post. How would you conditionally set it?
Vlachy goes by Kuba (2 years ago)
You could just include("page.php"); to put all logic from page.php to single.php and then in page.php on the right place you would do an if statement with is_single() checking whether it is a single or not :)
omar ob (3 years ago)
What an elegant programmer you are :)
Husain Ahmmed (3 years ago)
Just awesome
Diego CJ (3 years ago)
Gotta point something out of this video: The main page is displaying full content is it not? Well mine is (I don't mind it though, because I can use the dashboard items). Lets say if I would only want excerpts in all the pages then the "if" statement should be lightly changed right? I've tried to replace "the_content()" to "the_excerpt()" but the Read more button is not displaying :/
Diego CJ (2 years ago)
Agreed. We have the same opinion. Thanks for the answer for me and the other people =)
Vlachy goes by Kuba (2 years ago)
@Diego F Campos Jiménez Yea, I guessed that, but when 1 has a question, often more has the same question too :)
Diego CJ (2 years ago)
thanks for the reply, I had it figured by myself a while ago now XD thanks again
Vlachy goes by Kuba (2 years ago)
the_excerpt() itself does not output "read more" , but I think you are aiming for a slightly different thing: the "<!-- more -->" (without spaces, had to add them cause of youtube x) ... ) special comment tag - see e.g. https://codex.wordpress.org/Posts_Add_New_Screen#Visual_Versus_Text_Editor
Tahar Ouhrouche (3 years ago)
This is the best tutorial I have ever came through. I built a fully functional blog in a couple of hours following your videos! Awesome. Thanks a lot.
Mohammad Taghi Gholami (3 years ago)
im iranian you are very good tutorial for me
Saurav Kumar (3 years ago)
so easy to understand...Thankx for the tutorial.
Vinícius Egidio (3 years ago)
Man, you're a rockstar. Amazing tutorials!
David Cetinkaya (4 years ago)
Awesome tutorial! Thank you sir =)
Youssef kanouni (4 years ago)
very helpful tutorials,thank you brother
Prasad Chintala (4 years ago)
Excellent but think about making a single video of wordpress loops on get_posts( ),get_catogories( ) and get_pages( ), etc. Thanks in advance.
wahidur rahman (4 years ago)
after using this code in search page and  in archive page post shows [..] before Read more. How can i remove [..] 
MRbombonel (4 years ago)
you deserve waaay more views !
Geckomyecho (4 years ago)
Thanks so much. The highest quality of tutorials I've seen, extremely helpful (personal use, as a student and for my job).
spiderrobotman (4 years ago)
I would really like to know how to add widget areas, Is this something that's easy to do?
Jane Simon (4 years ago)
Great tutorials - Could you please create tutorials on how to create pagenation in wordpress? Please:)
Jane Simon (4 years ago)
@LearnWebCode Thanks - will be waiting for that tutorial as now I want to learn how to create wordpress themes and your tutorials seem to be the best for me:) So as it would be great if you could make tutorials on what is sidebar.php file and it's purpose and what are widgets and how to implement them - Thakns again love your tuts:)
LearnWebCode (4 years ago)
@Jane Simon Absolutely! I'll add pagination towards the top of my list for the next set of tutorials.
maikeru1 (4 years ago)
As a beginner in web programming, I find these videos highly useful. It used to look like a lot of jibberish to me. I hope you decide to continue making more videos! You know a web programming tutorial is good when you don't fall asleep halfway through.
alefnull (4 years ago)
i really hope you haven't simply stopped this series. i know it's only been a month or so since this last video, but i'm really really hoping for more. i've learned more from this series in the past two days than i have from a combination of other resources in the past month. please keep making tutorials, i truly appreciate them, and you for making them.
Long tee (4 years ago)
@alefnull i really hope too ,i have bought his undemy tutorial,he is such a good developer and teacther ,maybe he is too busy on work ,i hope he can post more and more , if free that's awesome ,even it should cost money ,i dont care,i will buy all of his course!!
Masud Parves (4 years ago)
Thanks for Great tutorial in WP. I want more Tutorial in WP theme . Please upload asap 
Ayebale John (4 years ago)
Thank you so much I have loved your work so much. I am a new designer in wordpress and I have been designing from scratch but nothing is still kind of difficult for me and that is How to make a good styled static home page using an Admin panel. Because currently I use widegets to through information on the home page. I really want to learn how to create a functioning Admin panel in wordpress. Hope you make this video
Softz skyder (5 years ago)
Great tutorial, Thanks
Joe Stivala (5 years ago)
Great tutorial, I remember you asking what ideas we had about future lessons.  Maybe Template on portable device scaling
alefnull (4 years ago)
@andy4tek as it stands, no. the theme developer is responsible for making sure that their particular theme responds well to other screen sizes, devices, etc.
LearnWebCode (5 years ago)
Hi Joe, that's a great idea!  I'll add a "Responsive / Mobile Basics" video for the WordPress series soon.

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.