wordpress不同分类不同模板如何实现
wordpress吧
全部回复
仅看楼主
level 8
请大神指教
2014年11月14日 03点11分 1
level 12
企业模版原理应该都是这样的 所有分类都可以用小工具布局
2014年11月14日 03点11分 2
怎么弄啊
2014年11月14日 04点11分
level 9
做个判断
2014年11月14日 03点11分 3
level 13
category-{id}.php 如分类ID为1就会使用 category-1.php 作为分类模板
2014年11月14日 04点11分 4
在哪里添加
2014年11月14日 04点11分
回复 伤心小笨牛 :在主题文件夹建一个名称为上面格式PHP文件,这个文件就是所对分类ID的分类模板
2014年11月14日 04点11分
回复 伤心小笨牛 :是分类模板不是文章页模板
2014年11月14日 04点11分
回复 E享乐 :加个好友QQ962688070
2014年11月14日 04点11分
level 8
这个不难啊,
1、建立一个archive.php文件,代码如下:
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( *content*, get_post_format() ); ?>
<?php endwhile; ?>
<div class="show-more"><?php next_posts_link(__(*加载更多*)); ?></div>
<?php else : ?>
<p>抱歉,暂时没有找到内容!</p>
<?php endif; ?>
2、建立content.php文件作为默认的样式文件,
content-gallery.php作为图片样式文件,
content-audio.php作为音频样式文件等等,
3、在functions.php文件引用函数
add_theme_support( *post-formats*, array(*gallery*, *video*, *audio* ) );
【以上是我使用的样式】
这是完整的文章样式:aside*, *gallery*, *chat*, *image*, *link*, *quote*, *status
当然,你在添加文章时候还需要在【更新】按钮下面选择文章形式!
2014年11月15日 00点11分 5
level 15
楼上正解
2014年11月15日 01点11分 6
1