WordPress Archive Tutorial (archive.php)

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • Join my 2024 Complete WordPress Course here learnwebcode.t...
    In this lesson we add a new file named "archive.php" to our theme folder and learn how to control the title text that is displayed for different types of archive listings (category, author, date).
    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...
    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

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

  • @homeowner1095
    @homeowner1095 10 ปีที่แล้ว +37

    Brad, I want to let your viewers know that hands-down, you are the most thorough and detailed teachers that I have ever seen online. I have viewed thousands of different videos with many, many "teachers". I have learned and retained more from each of your videos than any other service including paid services like Linda.com and Treehouse. To use a metaphor of yours, the content is 'easy to digest'. Not only that but your vocabulary and the way you use the English language is easy on the ears. I will be recommending you to all of my customers that want to learn more about their WordPress installation. Thank you

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

      Paul Douglas Thank you so much - you win the "nicest comment of the decade" award! Really appreciate the kind words. I'm glad the videos are helpful and I'll try to keep the WordPress content flowing :)

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

      I couldn't agree more with the above statement. Can't wait for MORE topics of education from you. Oh and btw, I bought your 7-hour course. Can't wait to dive into that. Thanks again, Brad.

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

      I have to echo Paul's sentiments. You are clear and concise and you explain at a level that novices can understand. Great Job.

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

      I would like this infinite times if possible, I have pretty much learned most of my knowledge of wordpress/js/jquery from Brad's channel. Pretty much the perfect teacher, with easy to understand explanations.

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

      agreed. he's a fantastic teacher ans simplifies everything so well.

  • @3-dog-solution
    @3-dog-solution 5 ปีที่แล้ว +2

    It's 2019, and these set of old tutorials are really relevant, and that's regardless of your current WordPress version. And Yes! - Some internal functions have been duplicated, but at least we can see them being built here, and through that building process: we can now see how the footings have been laid down in the first place.
    Archives Rule.
    It's all worth it, .. cos' your worth it.
    Thank you Brad.

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

      Ditto, 2024

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

    Well done! One critique would be it is a better practice to use a "switch" statement with that many conditions.
    This has been a great series to watch! Thanks for all of the hard work!

  • @IgorAherne
    @IgorAherne 8 ปีที่แล้ว +15

    Interesting to see how Lesson 1 had 600k views and as we dig deeper it gradually comes down to 40k. We are the survivors, everyone gave up... :D

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

      Ahah i was telling myself the same thing :p but I need time to $digest ahahah

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

      interesting tells me maybe some people just want to build one website and customize a little not learn code and make it our life. Each video does not stand alone they are a series most people dont have time for. How successful do you think Starbucks would be if they only sold to yuppies?

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

    I just finished creating the archive section for my new personal blog theme, and I saw that you did a video on archives, still gonna watch it.

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

    I set out to learn to make website several months ago and have been going back and forth between hand coding and Wordpress. Wordpress has been much easier but it also has nasty layout issues. (I felt so restricted) Some CSS editing worked, but eventually, I am back to learn from you.(I've been thinking about re-watching this series, but it felt very stressful... I just wish I came back earlier) I am learning at a whole different perspective and level now and seeing some real hopes to get the best of hand coding and Wordpress. THANK YOU !!!!

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

    Can't buy your courses, but I really thank you so much... Greeting from Colombia!

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

      Duban Soft You're welcome! Thanks for watching and I'm glad the videos are helpful!

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

    so far ,so good i completed all the previous lession and today looking forward to this video .You are awesome brad

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

    Awesome, I find clear concept in yiur tutorial.when i visit youtube look at your channel friquently to finding new tutorials.I want to get more awesome tutorials...waiting........

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

    Every part is awesome learn lot's of thing easily.

  • @vijaysingh-jr6dk
    @vijaysingh-jr6dk 9 ปีที่แล้ว

    Your teaching method is awesome i am subscribed with your channel now.....thanks.

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

    Love you man! Always coming back to this videos :)

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

    I really appreciate you making these videos. Please keep being awesome!

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

    Thank you very much Brad for posting this video

  • @gracefulali007
    @gracefulali007 6 ปีที่แล้ว +2

    Hi Bard,
    I am impressed how you are teaching in these videos, I have one question.
    on the Archive page -> inside the tag we can use the WordPress builtin function, which returns everything automatically instead of writing whole conditional logic
    what do you say?
    Thanks

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

      Sorry Brad, My Bad, i have figured out why you didn't showed that function in your video. because it was introduced in WordPress v 4,10 and you made this video 3 years ago.
      Great Job (y)

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

      Thanks for the information. How did you learn about this? Is there a video or place where I can learn about WP v 4.10 apart from the documentations?

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

    Excellent tuto, however there is a question about categories which dont show
    the get_the_category() doesn't return any categorie inspite of the fact that there are categories already created, it seems they are not added
    if you do a test
    if(!$categories)
    {
    echo '' there is no categories;
    }
    it prints there is no categories

  • @ahmad-ali14
    @ahmad-ali14 5 ปีที่แล้ว

    this is the best toturial

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

    Brad, your way of teaching is clear and effective, I think you are really great at it. With the same clearness could you explain to me why some WP built-in functions requires the "echo" command to print on the screen the return value (like get_the_date()) while some other doesn't (like single_cat_title())? Thank you in advance...

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

      Andrea Jimbo Great question. I think that is a result of the developers of WordPress trying to anticipate what we typically use a particular function for. For example, sometimes we just want to store a bit of data in a variable, or check to see what it's value is for an IF statement, etc... in those cases the function doesn't need to actually print or "echo" anything, it just needs to return a value. In other situations, the developers of WP realize that if we are querying for a blog posts title, it's probably a safe bet that we will also want to "echo" or print it out onto the page. In those cases, the WP devs are kind enough to bake the "echo" directly into the function to make our lives easier :)

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

      Thank you for the prompt reply, clear as I expected. I'm not a coder, I'm trying to learn to develop a WP theme through your tutorials. So I might ask you some other question in the future, hoping not to bother you too much :)

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

      LearnWebCode In my humble opinion, it just confuses people to "bake in" echo to certain functions and not others. It is a lot of memorization and most people work with many other languages if they are a coder.

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

      +Anthony Rosamilia There is always the WordPress Codex you can use as a reference how to use the functions. You can find them at codex.wordpress.org/ a very helpfull page.
      Or go directly to the WordPress Code Reference: developer.wordpress.org/reference/
      Click on functions and you see only functions.

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

    Thank you for these wonderful tuts

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

      I'm glad you find the videos useful!

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

    Brad in this video you mention a previous video you mention how to link to archive pages. for the author and category. Where Can I find this video?

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

    Very Good lesson :) greets from NZ

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

    Hi, thanks a lot for you best tutorial but i know that have you any woocommerce theme devloop tutorial ..

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

    LearnWebCode Hey, great tutorials so far. I find them immense! I am no coder, I am learning, but I do have a question - is there a reason that you use the elseif statements instead of a switch statement??

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

      +Gareth Dackevych-Thomas I think he wants to keep it as simple as he can. I think a switch statement should be possible as well.

  • @quangsang-anlocbiz5965
    @quangsang-anlocbiz5965 9 ปีที่แล้ว

    Thank you very much !

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

    I need to develop a sections that get the photos uploaded on the current date, like a newspaper has pages to display on front-page for their viewers. What is the concept best matches that it shows photos of the pages if the date is similar.

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

    Thank You a lot for the tutorial. However, I have a little problem. When I click on the author hyperlink, it doesn't show the archive, but when I click first on the category archive and then on the author archive, it does. I believe it's because the author is below the category in the elseif skeleton. Would You have any ideas how to solve it? Thanks

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

    Please answer my comment. I have a problem, my code is exactly like yours, but the Author link doesn't do anything when I click it and it doesn't bring me to an archive page where I can see the 'Author Archives' and the name of the author here. It's only work on the category page.

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

      Can you paste the code here.

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

      I faced the exact same issue with the author archives.The author link does not show up anything.Were you able to fix it?I just started watching these videos and I can see that you posted this reply a long time back,did you get through with the author archives issue.

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

    very very well explain

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

    Anybody know why we're using a switch statement here instead of the long list of elseifs? Also, why don't we just put the h2 tag above the if(have_posts()); instead of breaking the if statement in the middle?

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

    What is an archive? Type of page or post? What kind of entity? Is there something actually being archived, and what is that?

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

    Everything seems to be working for more except I cannot access any of the date archives, is there some option that I need to select?

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

    Brad, if i click on my category, the site displays "No content found". How can i resolve that problem? Or does anybody here know how?

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

    Pretty good tutorial so far.
    Does WP automatically looking for "archive.php"? Or how does he know, that he have to execute that file, if you did not link to it.?

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

      +Vita O I guess he also mentioned that in the start of the video, but WordPress has a build-in function to go to the archive.php, when present, if a category, tag, name or date list is needed.

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

      You can check other theme folders like twentyfifteen for list of available pages.

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

    Can someone help me? For some reason, when I change the settings to "Month and name" and click "View your site" it send me to "Not found"...

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

    Hey, Brad, I was just watching your tutorial and I had a question, is there a way to create archives for different blog pages, not POST themselves. Like if I have a blog for tacos and a blog page for cats, would it be possible to create an archive for both of those topics and keep them separate? Any help or direction is appreciated!

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

      Hi Axel, I'm not 100% sure I understand the setup you're describing - but would category archives help? One page that's a archive of the "Tacos" category and another page that's an archive of the "Cats" category?

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

    Hi!!
    10:20
    and post formats??????????
    is_format() does not exist and neither has_format() nor get_the_post_format() would work for this purpose!!!

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

    LearnWebCode I have a problem, my code is exactly like yours, but the Author link doesn't do anything when I click it and it doesn't bring me to an archive page where I can see the 'Author Archives' : and the name of the author here.
    This is the code for the author:
    elseif (is_author()) {
    the_post();
    echo 'Author Archives: '. get_the_author();
    rewind_posts();
    .
    .
    .
    .

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

    Brad, the coupon code for the CSS course is gone! Can you put it back up?

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

    Is "archive.php" a filename assigned by Wordpress to start with ?

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

    dunno what i did wrong. all links are is showing a Not Found Page. Please help

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

      Darling Bryan You can download the files I created in the video (link in description) to compare your code. If you don't have any typos, I would begin by heading into the WordPress Admin dashboard, going into settings -> Permalinks and making a change to the permalink structure and save, and then set it back to whatever setting you prefer and save again.

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

      LearnWebCode Thanks. I figured out the problem. It was on my Apache config. Thanks for the reply. Awesome tutorial btw.

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

    great job (Y)

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

    get_the_date(); does not showing any date

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

    🗽

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

    Fantastic tutorial!
    I removed all the content from the archive pages BUT I can't figure out how to remove the white blank space and the grey line that used to separate the posts in the category/archive pages. Could you please tell me if there is a code I need to add to remove these blank areas in the archive pages? I leave a link below to one of the archive pages
    bestellipticalmachinehut.com/proform/
    Thanks a lot in advance.

  • @HowTo-ny8ol
    @HowTo-ny8ol 5 ปีที่แล้ว

    echo "nice video";