Last month I used the Typecho blog system to open the blog "Customer Service Notes". After using it for a few months, I feel that TE is really good, simple and easy to use. Last night I thought of this blog with related articles, and realized that I did not have the function of adding related articles to "Customer Service Notes". This was a big loss for PV, so I quickly searched online for the method of calling related articles on the Typecho blog. , found on the TE official website.
Typecho's method of calling related articles:
1. Log in to the TE blog backend, move the mouse to "Control" on the menu bar, and select the "Appearance" option in the drop-down menu.
2. Select "Edit Current Appearance" in the new interface and select the post.php file for editing.
3. Add the following code where you need to call the relevant article, and then save the file
<?php $this->related(5)->to($relatedPosts); ?>
<ul>
<?php while ($relatedPosts->next()): ?>
<li><a href="<?php $relatedPosts->permalink(); ?>" title="<?php $relatedPosts->title(); ?>"><?php $relatedPosts->title() ; ?></a></li>
<?php endwhile; ?>
</ul>
Related article calling code description:
1. The main calling function is
$this->related($limits, $type);
2. The default value of $limits is 5, indicating the number of related articles displayed; the default value of $type is NULL, indicating the related method of the article, and only author is accepted. When $type is author, related articles are displayed based on the user; when $type is other values, related articles are displayed based on the tag.
Reminder: The CSS styles of related articles are designed according to your own theme needs.
» Please indicate the source when reprinting: Blog Bar
Thanks for the blog post