WordPress Post Meta Data Tutorial

Video is ready, Click Here to View ×


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 premium 8 hour HTML and CSS video course – save 40% through Friday May 6th: https://www.udemy.com/web-design-for-beginners-real-world-coding-in-html-css/?couponCode=learncsshtml15

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

Learn WordPress

Video is ready, Click Here to View ×

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

WordPress Date, Author, Category Output in Theme

Video is ready, Click Here to View ×

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,…

27 Comments

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

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

  3. 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[]= '<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

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

  5. <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
                    
                    <?php
                    
                    $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);
                        
                    }
                    
                    ?>
                    
                </p>

    11:0012: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".

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

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

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

  9. 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:
    <ul>
                            <li><?php the_time(' F jS, Y') ?> / </li>
                            <li> <?php the_author_posts_link() ?> / </li>
                            <li> <?php the_category(', ') ?></li>
                        </ul>

    Not meant to be critical, just trying to be helpful.  You're videos have been great :)

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

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

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

  13. 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(','); ?> 

Leave a Reply

Your email address will not be published.


*