Home Tutorials WP Theme Lesson #6c: Get Archives and Links

WP Theme Lesson #6c: Get Archives and Links

Author

Date

Updated on

Category

Today’s lesson is fairly easy. You’ll learn how to call for an archive link listing and the blogroll links. Tomorrow’s lesson is the calendar and search form.

Before we start, I want to explain why I’ve been breaking down my lessons into smaller lessons. Everything that you’re learning took self-taught people MONTHS to digest! It’s important that you understand everything I’m showing you the first time around so you won’t have to go back and re-check.

Step 1 – Add archive links.

Type the following codes in the Sidebar area, under the Categories listing:

<li><h2><?php _e(’Archives’); ?></h2>
<ul>
<?php wp_get_archives(’type=monthly’); ?>
</ul>
</li>

Give it some tab spacings for organization. Let’s see if your codes match mine:

add-archives

Save your file, refresh the browser, here’s the result:

archives

What happened?
You used the wp_get_arhives() PHP function with the type attribute and monthlyvalue to call for the archive links by month.

  • <li> – open list item
  • <h2> – open sub-heading
  • <?php _e(’Archives’); ?> – text of the sub-heading
  • </h2> – close sub-heading
  • <ul> – open unordered list under the sub-heading, within the list item
  • <?php wp_get_archives(’type=monthly’); ?> – call for archive links by month, nest each link within <li> and </li> tags. If you check your source codes (View > Page Source). You’ll see that wp_get_archives() generated list item (LI) tags for each link, just like the wp_list_cats() function.
  • </ul> – close the unordered list sitting under the sub-heading
  • </li> – close list item

Step 2: Add blogroll links

Type the following codes under the Archives link listing:

<?php get_links_list(); ?>

add-blogroll

Save, refresh, and here’s the result:

blogroll

By default, my blogroll is no different from yours. Here’s how it looks in the source codes:

blogroll-source

The organization is not all there because the get_links_list() function generates the codes for you, just like the wp_list_pages() function, you learned about, from yesterday’s lesson. However, it stuck with rule number one, which is close everything in the order that you open them. I circled the list item and unordered list tags for you to see.

That’s the end of today’s lesson. Come back tomorrow for the calendar and search form.

Follow this WordPress Theme Tutorial Series from the beginning.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Recent posts

10 Ways To Speed Up Post-Building Process With WordPress Gutenberg Themes

There’s no need to explain why I decided to start with Gutenberg-supporting products. All in all, Gutenberg is a well-known and long-awaited product. It is more...

HostPapa Linux Hosting: Reliable, robust and fast

As a small business owner, it can be challenging to find the right hosting provider for your website. HostPapa distinguishes itself from other web...

Are You Making These Costly Mistakes When Outsourcing?

In today’s world, it is almost impossible to find a small business where everything about the business process is done in-house. For most small...

Flat Design for Your WordPress Site: What Is It + 4 WordPress Flat Design Themes

Web designers in the past mostly used 3D styles for buttons that made the button seem more realistic. That all changed when flat design...

LawBlog WP Theme Review

Regardless of which area of law you practice, it’s imperative that you have proper online representation. You need to give your customers a feeling...

Recent comments