Introduction to typecho homepage log classification link?

124 5

It's published on the home page or the archives page:

One, about classification.

<span><?php _e('分类:');?><?php $this->category(',');?></span>

The output of the output is the form of links, and I want to output only the slug.

It's also a key classification.

Still the first page, I want to realize different categories, output different templates.
That's, to determine the classification of the current log, according to different code output.
Final implementation, list log list, different categories, display logs for different modes.
For example, the category is twitter, and a box is displayed.
For example: a classification is photo, and an attachment picture + jq fade effect for the output log.
For example: the classification is html and normal output.

Like this wp template: http://shangpan. Com/.

For example, thank you for 70.

2 Answers

138 2

First problem category function add parameter

<?php $this->category(',', false);?>

Second, create a category directory in the current template directory, and then create a template for the slug category, then create a file named default. Php under the category directory so that the program automatically calls the template file when you access the default category.

--- update ---

Two variables that use $this->categories and $this->category can meet your needs, but you need to manually loop the output yourself. Can you print_r these two variables to see their structure?

96 0

In addition to 70, you can.

<?php if($this->category =="分类A的缩略名"):?>
这里是分类A的样式
<?php else:?>
这里是分类B的样式
<?php endif;?>

http://forum. Typecho. Org/topic. Php? id..

...