1.wordpress常用插件 实际的博客页面 http://13.57.57.223/
a.多栏目导航插件使用,都可以根据名称在线搜索出来
插件名称:multi-level-navigation
功能使用:方便小白进行下拉导航栏的使用,延迟时间、样式都可以自己去调。(推荐)如果你会jquery,可以自己编写
实际效果:
b.瀑布流插件使用
插件名称:post-grid
功能实用:可以实现前端界面的内容的瀑布流的使用。内容可根据类别、标签、文章、等等选项去排版。
实际效果:
c.tags云插件
插件名称:tag-cloud,插件在widgets里面自行添加
功能实用:把标签以云块显示
实际效果:
d.slidbar插件的使用
插件名称:AVH Extended Categories Widgets,搜索安装
功能实用:侧边栏,可以实现类目的划分(功能较齐全,自行调试)
实际效果:
如何实现类目页、tag详情页、作者详情页的不同内容的划分?
1.如何实现不同类目的列表页模板编写?
打开 /home/centos/www/blog/blog/wp-content/themes/twentyseventeen中类目模板文件
archive.php
常用的写法就是if else
<?php
if ( is_category(5) ) {
include(TEMPLATEPATH . '/image_list.php');
} else {
include(TEMPLATEPATH . '/article_list.php');
}
?>
但我这里选择用swich case,循环,因为分类比较多的原因
switch ( is_category()) {
case is_category(14):
include(TEMPLATEPATH . '/archive-video.php');
break;
case is_category(17):
include(TEMPLATEPATH . '/archive-artical.php');
break; }
大功告成!
2.如何实现tag标签内容的详情页的编写?
同上类目列表一样的套路
<?php
switch ( is_tag()) {
case is_tag(56):
include(TEMPLATEPATH . '/tag_led1.php');
break;
case is_tag(53):
include(TEMPLATEPATH . '/tag_3d-printer.php');
break; }
另外附上我的一个tag模板
<?php get_header(); ?>
<div class="wrap">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
</header><!-- .page-header -->
<?php endif; ?>
<?php if(function_exists('wp_thumbnails_for_recent_posts')) { wp_thumbnails_for_recent_posts('num=20&width=75&height=75'); } ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php echo do_shortcode("[post_grid id='508']"); ?> 此处是调用pos_grid的瀑布流插件
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div><!-- .wrap -->
<?php get_footer();?>
好,tag标签页已经可以正藏实现
3.作者详情页如何实现?
<div id="post-grid-208" class="post-grid grid">
<div class="grid-nav-top">
<?php
if(isset($_GET['author_name'])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));
endif;
?>
<em>Search results for</em>
<p>"<?php echo $curauth->nickname; ?>"</p>
<span>
Descriptions: <?php the_author_description(); ?><br/>
Email: <a href="mailto:<?php the_author_email(); ?>" target="_blank"><?php the_author_email(); ?></a>
</span>
</div>
<div class="grid-items " id="">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="item mix skin even flat moons-products ">
<div class="layer-media">
<a href="<?php the_permalink() ?>" title="Permanent Link: <?php the_title(); ?>"><?php if ( has_post_thumbnail() ) : ?>
<?php the_post_thumbnail( 'thumbnail' ); ?>
<?php else: ?>
<?php if(function_exists('wp_thumbnails_for_homepage')) { wp_thumbnails_for_homepage(); } ?>
<?php endif; ?></a>
</div>
<div class="layer-content">
<div class="element element_0 categories ">
<?php the_category('&');?>
</div>
<a target="_blank" class="element element_1 title_link" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<p id="list_autghor1112"><?php the_author_posts_link(); ?></p>
<div class="element element_3 post_date">
<?php the_time('d M Y'); ?>
</div>
</div>
</div>
<?php endwhile; else: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
</div>
</div>