WordPress Post Meta Data Tutorial

WordPress Post Meta Data Tutorial

FavoriteLoadingAdd to favorites

In this lesson we learn how to output the date (and control the formatting) as well as the author name and category. Check out my “Get a Developer Job” course: https://www.udemy.com/git-a-web-developer-job-mastering-the-modern-workflow/?couponCode=YOUTUBE-HALF-OFF

To view a complete list of the WordPress lessons in sequential order visit:

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):

Want to share the WordPress website that you’ve been creating on your computer with the world? Learn about the web host I use and how you can get a domain + hosting for $4.95 a month ($60 savings): http://learnwebcode.com/web-hosting/

Sign up for my newsletter to receive periodic webDev tips, tricks, resources and coupons. Join the list at http://learnwebcode.com/

Follow LearnWebCode on Twitter for resources and updates:

By |2017-06-06T01:24:50+00:00June 6th, 2017|Wordpress Video Tutorials|50 Comments


  1. Nick RT June 6, 2017 at 1:24 am - Reply

    I just found out that:

    – The WHOLE array codes can be simply replace with– the_category(‘, ‘); — including the commas and removing comma at the end.
    – Also the author link can be echo-ed by simply using the_author_posts_link();

    Hope that helps.

  2. navab villordon June 6, 2017 at 1:30 am - Reply

    love ur tutorial bro, this can help me a lot

  3. AntilopeSalga June 6, 2017 at 1:31 am - Reply

    Your tutorials are just AWESOME! Great didatic (:
    Thank you!

  4. Justin Munce June 6, 2017 at 1:32 am - Reply

    Hi, great tutorial, as all of these are. I’ve actually watched them many times each! Is there a way to link the_modified_author to his posts (the same way you do with the author)? Thanks

  5. Dan Fedillaga June 6, 2017 at 1:33 am - Reply

    Thanks, it is a great head start for us newbies!

  6. nathonas June 6, 2017 at 1:33 am - Reply

    You deserve way more views!

  7. Shihan June 6, 2017 at 1:34 am - Reply

    <p class="post-info"><?php the_time(‘F j, Y g:i a’) ?> | by <a href="<?php echo get_author_posts_url(get_the_author_meta(‘ID’)); ?>"></a> | Posted in
                    $categories = get_the_category();
                    $seperator = ", ";
                    $output = ”;
                    if ($categories) {
                        foreach ($categories as $category) {
                            $output .= ‘<a href="’ . get_category_link($category->term_id) . ‘">’ . $category->cat_name . ‘</a>’ . $seperator;
                        echo trim($output, $seperator);

    11:00 – 12:00. It does not work. Have you got any idea that can fix this error? While opening the Category, the url shows "/category/news" but when it comes to content it says, "No content found".

  8. Charlotte J June 6, 2017 at 1:34 am - Reply

    Hello, when I started this tutorial everything was working but I have changed my permalinks and now, when i want to go to a link (page, article..) I have 404 not found. I’m realy lost, if somebody can help me..

  9. Arif Sediq June 6, 2017 at 1:35 am - Reply

    the_category() will do the same thing and will display as a link , I really do not know , if I am making a mistak or that is also okay ?

  10. sandyp regmi June 6, 2017 at 1:35 am - Reply

    Finally got what i want.. thanks for the simple and clear video !! 🙂

  11. A Shen June 6, 2017 at 1:36 am - Reply

    Any reason we wouldn’t want to do this: Posted in  <?php the_category(", "); ?> instead of doing all that array stuff.  I’m just starting to learn wp, and there seems to be different ways to do things.

  12. Yanka Dudenko June 6, 2017 at 1:36 am - Reply

    I haven’t tried other tutorials, but judging by the comments in all the videos yours are the best ones. I’m very lucky I landed on yours right away. So thorough and very understandable. I’m enjoying the process of building the site step-by-step even though I sometimes spend a couple of days trying to figure out where a mistake lies. Thank you Brad!!

  13. tomxxi June 6, 2017 at 1:39 am - Reply

    Your tutorials are awesome, better than any others I’ve seen on these topics. Thanks!

  14. Rajni Nair June 6, 2017 at 1:39 am - Reply

    Thank you so much for this wonderful turorial series.

  15. PG Tips June 6, 2017 at 1:40 am - Reply

    Thank you very much for these awesome tutorials. You are an outstanding teacher and I am so grateful you have shared your knowledge. I am learning fast. 😊

  16. Zoran Vulanović June 6, 2017 at 1:40 am - Reply

    Well, you are great teacher of this tutorial and i learn so much about wordpress but i like to suggest you something about $categories part. You see there is simple and elegant way to output result of categories and you do not need extra code to remove coma from last categorie so i’m gonna write a code.

    /******************************* PHP CODE BEGIN ******************************/

    $categories = get_the_category();
    $separator  = ", "; 
    $output       = []; //array() is old school
        foreach($categories as $category){
            $output[]= ‘<a href="’ . get_category_link($category->term_id) . ‘">’ . $category->cat_name . ‘</a>’;
    echo implode($separator , $output);

    /*******************************PHP CODE END ******************************/
     It is cleaner code that way

  17. Rodney Lacambra June 6, 2017 at 1:41 am - Reply

    Hi Brad. I am creating project theme of a friend. I just want to clarify on linking and outputting category. As I had observed the codes works just fine without doing what you did in this tutorial. I just added this piece of WordPress built-in function called "the_category" and just pass along a "comma" as separator.

    This is the code:

    <p class="post-info">This post was written by <a href="<?php echo get_author_posts_url(get_the_author_meta(‘ID’)); ?>"><?php the_author(); ?></a> on <?php the_time(‘l, F jS, Y’); ?> and is filed under <?php the_category(‘, ‘) ?></p>

    Q: Is there any disavantages and/or advantanges of what you did compares to mine?

    Looking forward to get an answer from you.


    Source: http://codex.wordpress.org/Function_Reference/the_category

  18. CoDeditingtutorials June 6, 2017 at 1:42 am - Reply

    I have one small problem. The category shows underneath the "Posted in" how do i fix this?

  19. Its-me92 June 6, 2017 at 1:44 am - Reply

    Could you tell me please how did you do that your URL looks like "author/admin"?? In my situation its look like "http://localhost/?author=1&quot; and I dont think it looks nice. The same problem about category ;/

  20. Ashley McGee June 6, 2017 at 1:46 am - Reply

    This is the best tutorial. I find your technical communication to be spot on. I’m almost all the way through your series, working and learning as I go, and thus far this is the most comprehensive yet noob-friendly tutorial series on ground-up php for WordPress. Everyone could stand to learn a lot from the way you introduce and walk through the content. Thank you so much for doing this series.

  21. ash3rr June 6, 2017 at 1:48 am - Reply

    Hullo everyone

  22. Husain Ahmmed June 6, 2017 at 1:50 am - Reply


  23. TheOriginReport June 6, 2017 at 1:51 am - Reply

    Hello Brad,

    Quick question. When you write the code to get the category information starting on line 13, should we be extracting this functionality into a function inside the functions.php file or is it fine to keep it in this file? I assume we won’t be re-using this code block elsewhere so I assume it is fine as-is, but I was just curious what the best practices would be in this and similar cases. Thanks and loving the series so far!

  24. Helal Uddin June 6, 2017 at 1:52 am - Reply

    I have watched your each and every tutorials more than 10times, really I have learned many things.
    Thank you so much to expend you valuable times to make all great tutorials.

  25. Josh Espinoza June 6, 2017 at 1:52 am - Reply

    Please Let me know if this is incorrect. Maybe its just new since the video creation, but I was able to output the date, author(with link to authors posts), and categories separated with comma (and with category link) with a lot less code.

    Here is the code I use:
                            <li><?php the_time(‘ F jS, Y’) ?> / </li>
                            <li> <?php the_author_posts_link() ?> / </li>
                            <li> <?php the_category(‘, ‘) ?></li>

    Not meant to be critical, just trying to be helpful.  You’re videos have been great 🙂

  26. saif amori June 6, 2017 at 1:54 am - Reply

    hi sir we need toturials for plugin wordpress please

  27. Bogdan Martinescu June 6, 2017 at 1:57 am - Reply

    in the case of categories instead of foreach, wouldn’t it be easier to implode(", ", $categories); ?

  28. Rangga Luksatrio June 6, 2017 at 1:57 am - Reply

    Hey! Love your videos. I am actually building my website on the foundation of your videos. I was hoping to ask how you can add the comment section on your posts? Also, I wanted to add a plugin that enables share buttons within every post but I believe that there is a hook that enables plugins to work for posts specifically. Your reply will be greatly appreciated!

  29. Jxargo June 6, 2017 at 1:58 am - Reply

    Great video! My code, copied exactly, is going to the right place and opening the right page, i.e. /wordpress/category/uncategorised/ – but even though I’ve got three sample posts in that category I’m getting the ‘No content found’ text, which is the else if no posts are found. (Happens with all categories I have created in dashboard). Can anyone think why this might happen?

  30. me14 June 6, 2017 at 1:58 am - Reply

    Great work Nikola, this is the best course about WP ever !
    is there a possibilty to Donate for your work ?

  31. John T June 6, 2017 at 2:00 am - Reply

    These lessons are awesome! Do you have a blog that resembles the same content?

  32. videoguy640 June 6, 2017 at 2:01 am - Reply

    This tutorial series is excellent!

  33. Anthony Giello June 6, 2017 at 2:03 am - Reply

    These are the best WordPress Development tutorials I have come across. I have been trying to learn WP for almost a year and this is by far the best playlist on YouTube. One thing… my category links aren’t going anywhere almost like i have # as the reference, but I have the code the way it should be. Also author link not showing in the tool bar, but I also only have one author so that may be common in that case. I have two posts with two different categories. I just cant get them to show alone on a category page, the link is either broken or the function is obsolete. Can you help please? Many many thanks!

  34. Mufaddal Motorwala June 6, 2017 at 2:04 am - Reply

    Hi LearnWebCode, Thanks for tutorials, I found one easier way for single and multiple categories separated with comma using below code, it makes category hyperlink as well : 
    <?php the_category(‘,’); ?> 

  35. Jakub Šimandl June 6, 2017 at 2:05 am - Reply

    Best tutorials (y) 🙂 Thanks very usefull!

  36. Booger Bomber June 6, 2017 at 2:05 am - Reply

    Hi im new to wordpress i just want to ask i have the url location correct but it does’nt display a thing its just a blank page.

  37. Shawn Ritch June 6, 2017 at 2:07 am - Reply

    Your tutorials are awesome, and I don’t say that lightly. I’m leaning FAST and implementing my new knowledge by building themes and plugins for my own websites. THANKS!!!

  38. Nikola Ivanov June 6, 2017 at 2:07 am - Reply

    Thank you for the tutorial :).
    Way better and easier to understand than Lynda’s tutorials on WP 🙂

  39. Enkii Muto June 6, 2017 at 2:09 am - Reply

    can anyone here help me? WP usually queries and delivers an array of objects, and it seems like a TERRIBLE waste of memory when all I want is an ID and perhaps one thing or another.

  40. Wencheng HU June 6, 2017 at 2:09 am - Reply

    Hello, this video tutorial is very impressive, clear and logic for learners. Brad, you did a great job! Enjoying your videos very  much. Thank you!

  41. Arif Sediq June 6, 2017 at 2:10 am - Reply

    the_author_posts_link: will basically do the same thing?
    Why should we not use this function?

  42. rot rose June 6, 2017 at 2:13 am - Reply

    this series of wp tutorials are really greatly helpful. want more….

  43. Hassan al-humaid June 6, 2017 at 2:15 am - Reply

    When I use the function get_category_link($category->term_id), all the categories becomes links but when i click on them, a page shows up where it says  No content found. 11:00 – 12:00 in the video.. please help me i’m stuck

  44. The Choco Guy June 6, 2017 at 2:16 am - Reply

    at 11:14 i tried using  get_category_link($category) only and it worked. is there any cons for just using the category itself instead of the id?

  45. Neetha Alex June 6, 2017 at 2:18 am - Reply

    This is what i am searching for. thank you so much ,Great job 🙂

  46. SnoozlesLP June 6, 2017 at 2:20 am - Reply

    I’m not sure if anybody still reads these but I’m getting access denied when clicking on the author link. Can someone help me with that?

  47. JonathanItzen June 6, 2017 at 2:20 am - Reply

    Your tutorials are amazing. Thanks!

  48. Miguel Machado June 6, 2017 at 2:22 am - Reply

    Thanks for this tutorial! You really made my day

  49. Adam Nanista June 6, 2017 at 2:22 am - Reply

    offtopic but its kinda funny to see that the first video of this tutorial has like 500 000 views and this one has 50 000.

  50. Wyatt Castaneda June 6, 2017 at 2:22 am - Reply

    Just a quick update for anyone watching after July 2016, for whatever reason this method isn’t working for me, not sure if its a product of WordPress updates, or method of user authentication, etc. (@LearnWebCode any ideas)

    Never the less, I found the following code to work:

    <a href="<?php echo get_author_posts_url( get_the_author_meta( ‘ID’ ), get_the_author_meta( ‘user_nicename’ ) ); ?>"><?php the_author(); ?></a>

    I found this on the WP Codex at: https://codex.wordpress.org/Function_Reference/get_author_posts_url

Leave A Comment