<?php wp_list_bookmarks('categorize=0&category=2&before=<span>&after=</span>&show_images=1&show_description=0&orderby=url'); ?>
//2.标签
云wp_tag_cloud();
//标签
function tagtext($str){
global $post;
$gettags = get_the_tags($post->ID);
if ($gettags) {
foreach ($gettags as $tag) {
$posttag[] = '<'.$str.'>'.$tag->name.'</'.$str.'>';
}
$tags = implode( '', $posttag );
echo $tags;
}
}
//友情链接
<?php wp_list_bookmarks( $args ); ?>
<?php $args = array(
'orderby' => 'name',
'order' => 'ASC',
'limit' => -1,
'category' => ' ',
'exclude_category' => ' ',
'category_name' => ' ',
'hide_invisible' => 1,
'show_updated' => 0,
'echo' => 1,
'categorize' => 1,
'title_li' => __('Bookmarks'),
'title_before' => '<h2>',
'title_after' => '</h2>',
'category_orderby' => 'name',
'category_order' => 'ASC',
'class' => 'linkcat',
'category_before' => '<li id=%id class=%class>',
'category_after' => '</li>' ); ?>
//查询
<?php
$linksql = "select * from ".$table_prefix."term_relationships as T1 left join ".$table_prefix."links as T2 on T1.object_id=T2.link_id where T1.term_taxonomy_id=14 limit 15";
$linkresult = $wpdb->get_results($linksql);
foreach ($linkresult as $key => $value) {
?>
<li><a target="_blank" href="<?php echo $value->link_url;?>">
<div class="ng-quick-img"><img src="<?php echo $value->link_image;?>" alt="" /></div>
<div class="ng-quick-tit"><?php echo $value->link_name;?></div>
</a></li>
<?php } ?>
<?php get_sidebar(); ?>
设置模板
/**
Archive Template:大学
**/
/*
Template Name: contact
*/
add_action('template_include', 'load_single_template');
function load_single_template($template) {
$new_template = '';
// single post template
if( is_single() ) {
global $post;
// 'wordpress' is category slugs
if( has_term('daxue', 'category', $post) ) {
$new_template = locate_template(array('single-daxue.php' ));
}
if( has_term('gaozhong', 'category', $post) ) {
$new_template = locate_template(array('single-gaozhong.php' ));
}
}
return ('' != $new_template) ? $new_template : $template;
}
总找到的总数
<?php
global $wp_query;
echo $wp_query->found_posts;
?>
<!-- Column 1 /Content -->
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<h3 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> //一、文章标题
<?php the_tags('标签:', ', ', ''); ?> //二、文章标签:
<?php the_time('Y年n月j日') ?> 三、日期
<?php comments_popup_link('0 条评论', '1 条评论', '% 条评论', '', '评论已关闭'); ?> //四、评论数
<img class="thumb" src="<?php bloginfo('template_url'); ?>/images/610x150.gif" alt=""/> //图片
<?php the_content(); ?> //内容
<p class="clearfix"> <a href="<?php echo get_option('home'); ?>" class="button float" ><< 返回首页</a> <a href="#commentform" class="button float right" >发表评论</a> </p>
<?php get_sidebar(); ?>
<?php endif;endwhile; // end of the loop. ?>
http://suoling.net/creating-the-table-for-your-data-in-wordpress/