Lecture
Today's lesson is quite simple. We will learn to call a list of links to archives and blog blogs (a list of links to blogs or websites). And next time we will look at the calendar and the “Search” field.
Before starting, I want to explain why I began to break my lessons into smaller ones. Everything that you are studying now has required a lot of time for those who studied themselves to sort out and systematize their knowledge. It is important for me that you understand everything the first time so that you do not have to go back and reread the lessons.
Add links to archive records. Paste the following code in the sidebar area, below the category list:
one 2 3 four five | <li><h2><?php _e('Archives'); ?></h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> </li> |
Let's see if your code matches mine:
Save the file, refresh the browser, here is the result:
What happened?
You used the wp_get_archives () function with a type attribute and a monthly value to call up a list of archives, grouped monthly.
Add links to the blogs feed. Type the following code under the archive list:
<? php get_links_list (); ?>
Save the file, update the window, here is the result:
By default, my blog feed is no different from yours. Here’s what it looks like in the source code:
Code organization is not perfect, because the get_links_list () function generates the code for you, just like the wp_list_pages () function that you met in the last lesson.
That's all for today. In the next lesson you will learn about the calendar and search.
Comments
To leave a comment
Content Management Systems (CMS)
Terms: Content Management Systems (CMS)