WordPress Post Meta Data Tutorial

WordPress Post Meta Data Tutorial


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:

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 .95 a month ( savings):

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

Follow LearnWebCode on Twitter for resources and updates:

37 Comments

37 Replies to “WordPress Post Meta Data Tutorial”

  1. 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?

  2. 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

  3. 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.

  4. | by <a href="”> | Posted in
                    
                    <?php
                    
                    $categories = get_the_category();
                    $seperator = ", ";
                    $output = '';
                    
                    if ($categories) {
                        
                        foreach ($categories as $category) {
                            
                            $output .= 'term_id) . ‘”>’ . $category->cat_name . ‘‘ . $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”.

  5. 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..

  6. 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
    if($categories){
        foreach($categories as $category){
            $output[]= ‘term_id) . ‘”>’ . $category->cat_name . ‘‘;
      }
    echo implode($separator , $output);

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

  7. Any reason we wouldn’t want to do this: Posted in   instead of doing all that array stuff.  I’m just starting to learn wp, and there seems to be different ways to do things.

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

  9. 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!

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

  11. 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.

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

  13. 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.

  14. 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!!!

  15. 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. 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.

  17. 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.

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

  19. 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 ?

  20. 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!

  21. 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!!

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

Comments are closed.