调用头部模板
<?php get_header();?>

调用尾部模板
<?php get_footer();?>

调用侧边栏
<?php get_sidebar();?>

放在head标签内,方便插件调用:
<?php wp_head(); ?>

放在footer里,body结束之前,方便插件调用:
<?php wp_footer(); ?>

----------------------------------------------------------

头部编码调用:
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />

头部css调用:
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" media="screen" />

style.css路径调用:
<?php bloginfo( 'stylesheet_url' ); ?>

博客标题:
<?php bloginfo('name'); ?>

博客副标题:
<?php bloginfo('description'); ?>

主页地址:
<?php echo get_option('home'); ?>

<?php bloginfo('home'); ?>

主题模板所在路径:
<?php bloginfo('template_directory'); ?>

----------------------------------------------------------

page页面列表:
<?php wp_list_pages('sort_column=menu_order&title_li=&depth=2&include='); ?>

分类目录列表:
<?php wp_list_categories('title_li=&orderby=name&show_count=0&depth=2'); ?>

----------------------------------------------------------

主循环的开始和结束:
<?php if(have_posts()) : ?>
<?php while(have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>

文章的URL地址:
<?php the_permalink() ?>
文章标题:
<?php the_title(); ?>
文章内容:
<?php the_content('Read more...'); ?>
文章摘要:
<?php the_excerpt(); ?>
文章所在分类:
<?php the_category(', ') ?>
文章发布时间:
<?php the_time('Y-m-d') ?>
文章作者:
<?php the_author_posts_link(); ?>
文章评论数量:
<?php comments_number('No comment', '1 comment', '% comments'); ?>
文章标签:
<?php the_tags( 'Tags: ', ', '); ?>

文章评论:
<?php comments_template(); ?>

多页型文章的翻页按钮(调用:<!--nextpage-->):
<?php wp_link_pages(); ?>

----------------------------------------------------------

小工具边栏调用:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar') ) : ?>
<?php endif; ?>

小工具动态边栏注册(functions.php):
<?php
if ( function_exists('register_sidebar') ) {
    register_sidebar(array(
  'name'=>'Sidebar',
        'before_widget' => '<div class="widget">',
        'after_widget' => '</div>',
        'before_title' => '<h4>',
        'after_title' => '</h4>',
    ));}
?>

自定义菜单调用:
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>

自定义菜单注册(functions.php):
<?php register_nav_menu('primary',__('Primary Navigation')); ?>

----------------------------------------------------------
 
最新文章列表:
<?php wp_get_archives('type=postbypost&limit=10'); ?>

文章按月归档列表:
<?php wp_get_archives('type=monthly'); ?>

RSS地址:
<?php bloginfo('rss2_url'); ?>

标签云:
<?php wp_tag_cloud('smallest=8&largest=32'); ?>

友情链接:
<?php wp_list_bookmarks(); ?>

翻页插件按钮调用:
<?php if(function_exists('wp_pagenavi')) wp_pagenavi(); ?>

列表页面的上一页下一页调用:
<span class="older"><?php previous_posts_link() ?></span>
<span class="newer"><?php next_posts_link() ?></span>

文章页面的上一篇下一篇调用:
<span class="older"><?php previous_post_link(); ?></span>
<span class="newer"><?php next_post_link(); ?></span>

缩略图调用:
<?php the_post_thumbnail(); ?>

缩略图功能启用(functions.php):
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 200, 150, true ); // 普通的缩略图

搜索框调用:
<?php get_search_form(); ?>

在分类页面显示分类名称:
<?php single_cat_title(); ?>
----------------------------------------------------------

style.css版权信息

/*
Theme Name: wpcourse theme
Theme URI: http://www.pprar.com

Description: wpcourse blog theme
Author: ralph
Author URI: http://www.99jianzhu.com

Version: 1.0
Tags: white, simple, blog, wpcourse
*/

----------------------------------------------------------

更多wordpress标签参考:
http://codex.wordpress.org/Function_Reference

----------------------------------------------------------

WP Kit CN 中文工具箱插件可直接调用的标签:
<?php wkc_recent_posts() ?> 显示最新文章
<?php wkc_random_posts() ?> 显示随机文章
<?php wkc_related_posts() ?> 显示相关文章
<?php wkc_posts_in_the_same_categories() ?> 输出同一个分类下的文章
<?php wkc_most_commented_posts() ?> 显示评论最多的文章
<?php wkc_recent_comments() ?> 显示最新评论
<?php wkc_recent_pings() ?> 显示最新pingback和trackback
<?php wkc_most_active_commentors() ?> 显示n天内,评论最多的用户
<?php wkc_recent_commentors() ?> 显示本周或者本月内评论最多的用户
使用说明:
http://sexywp.com/wp-kit-cn-doc
----------------------------------------------------------
调用最新文章列表(方法2):
<?php
 $args = array( 'numberposts' => '10' );
 $recent_posts = wp_get_recent_posts( $args );
 foreach( $recent_posts as $recent ){
  echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
 }
?>

----------------------------------------------------------
调用某个分类下的最新文章列表:
<?php
 $args = array( 'numberposts' => '5','category'=>'41' );
 $recent_posts = wp_get_recent_posts( $args );
 foreach( $recent_posts as $recent ){
  echo '<li><a href="' . get_permalink($recent["ID"]) . '">'.$recent["post_title"].'</a></li> ';
 }
?>

调用某个分类下的最新文章列表(方法2):
<ul>
<?php
global $post;
$args = array( 'numberposts' => 5, 'category' => 1 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
 <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>

调用某个分类下置顶的文章列表:
<?php
 $args = array( 'numberposts' => '5','category'=>'41' );
 $recent_posts = wp_get_recent_posts( $args );
 foreach( $recent_posts as $recent ){
 if (is_sticky($recent["ID"])) {
  echo '<li><a href="' . get_permalink($recent["ID"]) . '">'.$recent["post_title"].'</a></li> ';
  }
 }
?>

----------------------------------------------------------
面包屑导航:
<?php if(function_exists('bcn_display'))
{
 bcn_display();
}?>
----------------------------------------------------------
在分类页面显示子分类列表:
<?php
$args=array(
  'orderby' => 'name',
  'order' => 'ASC',
  'child_of'  => 1
  );
$categories=get_categories($args);
  foreach($categories as $category) {
    echo '<li class="nav2">
 <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a>
 </li>';
    }
?>
----------------------------------------------------------
热评文章列表(functions.php):
<?php function simple_get_most_viewed($posts_num=10, $days=30){
global $wpdb;
$sql = "SELECT ID , post_title , comment_count
FROM $wpdb->posts
WHERE post_type = 'post' AND TO_DAYS(now()) - TO_DAYS(post_date) < $days
ORDER BY comment_count DESC LIMIT 0 , $posts_num ";
$posts = $wpdb->get_results($sql);
$output = "";
foreach ($posts as $post){
$output .= "\n<li><a href= \"".get_permalink($post->ID)."\" rel=\"bookmark\" title=\"".$post->post_title." (".$post->comment_count."条评论)\" >".$post->post_title."</a> </li>";
}
echo $output;
}
?>

----------------------------------------------------------
随机文章列表:
<?php
$rand_posts = get_posts('numberposts=10&orderby=rand');
foreach($rand_posts as $post) : ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach;?>

分类页面调用缩略图(wp_thumbnails插件):
<?php if(function_exists('wp_thumbnails_for_category')) { wp_thumbnails_for_category(); } ?>

W​o​r​d​P​r​e​s​s​常​用​标​签​和​调​用​总​结的更多相关文章

  1. w​i​n​d​o​w​s​ ​s​e​r​v​e​r​ ​2​0​0​8​ ​r​2​ ​启​用​索​引(转)

    08r2的“windows search”服务默认是不安装的,要想启用索引执行下列步骤:        1.打开“服务器管理”——选中“角色”——右边选中“添加角色”——勾选“文件服务”.    2. ...

  2. 【R笔记】R语言函数总结

    R语言与数据挖掘:公式:数据:方法 R语言特征 对大小写敏感 通常,数字,字母,. 和 _都是允许的(在一些国家还包括重音字母).不过,一个命名必须以 . 或者字母开头,并且如果以 . 开头,第二个字 ...

  3. 【R笔记】R语言进阶之4:数据整形(reshape)

    R语言进阶之4:数据整形(reshape) 2013-05-31 10:15 xxx 网易博客 字号:T | T 从不同途径得到的数据的组织方式是多种多样的,很多数据都要经过整理才能进行有效的分析,数 ...

  4. Python获取爬虫数据, r.text 与 r.content 的区别

    1.简单粗暴来讲: text 返回的是unicode 型的数据,一般是在网页的header中定义的编码形式. content返回的是bytes,二级制型的数据. 如果想要提取文本就用text 但是如果 ...

  5. R语言 启动报错 *** glibc detected *** /usr/lib64/R/bin/exec/R: free(): invalid next size (fast): 0x000000000263a420 *** 错误 解决方案

    *** glibc detected *** /usr/lib64/R/bin/exec/R: free(): invalid next size (fast): 0x000000000263a420 ...

  6. velecity报错:Caused by: org.apache.velocity.exception.ParseErrorException: Lexical error, Encountered: <EOF> after : "\'/order/pay?activity=\" + activityId);\r\n }*/\r\n</script>\r\n#end\r\n" at /a

    Caused by: org.apache.velocity.exception.ParseErrorException: Lexical error, Encountered: <EOF> ...

  7. Android中View自己定义XML属性具体解释以及R.attr与R.styleable的差别

    为View加入自己定义XML属性 Android中的各种Widget都提供了非常多XML属性,我们能够利用这些XML属性在layout文件里为Widget的属性赋值. 例如以下所看到的: <Te ...

  8. 批量修改文件权限 和所有者 chown nobody:nobody * -R chmod 775 * -R

    chown nobody:nobody * -R chmod 775 * -R

  9. S​Q​L​_​S​e​r​v​e​r​_​2​0​0​8​定​期​自​动​备​份​详​细​图​解

    S​Q​L​_​S​e​r​v​e​r​_​2​0​0​8​定​期​自​动​备​份​详​细​图​解 设置自动数据库的定期备份计划. http://wenku.baidu.com/link?url=Tu ...

随机推荐

  1. 万字总结:学习MySQL优化原理(转)

    本文转自:https://www.tuicool.com/wx/2eMBfmq 前言 说起MySQL的查询优化,相信大家收藏了一堆奇技淫巧:不能使用SELECT *.不使用NULL字段.合理创建索引. ...

  2. Java并发包——Blockingqueue,ConcurrentLinkedQueue,Executors

    背景 通过做以下一个小的接口系统gate,了解一下mina和java并发包里的东西.A系统为javaweb项目,B为C语言项目,gate是本篇须要完毕的系统. 需求 1. A为集群系统,并发较高,会批 ...

  3. Python 3 初探,第 2 部分: 高级主题

    Python 3 是 Guido van Rossum 功能强大的通用编程语言的最新版本.它虽然打破了与 2.x 版本的向后兼容性,但却清理了某些语法方面的问题.本文是这个由两部分组成的系列文章中的第 ...

  4. hdu 1348 Wall (凸包模板)

    /* 题意: 求得n个点的凸包.然后求与凸包相距l的外圈的周长. 答案为n点的凸包周长加上半径为L的圆的周长 */ # include <stdio.h> # include <ma ...

  5. libevent2源码分析之五:关键的调用链

    用一个调用链来表示函数调用的流程,看起来更直观.根据上面的分析,总结了一些重要的调用链. 初始化 event_base_new event_base_new_with_config min_heap_ ...

  6. 【Java】Java_16 控制循环结构Break、Continue、Return

    1.break break用于完全结束一个循环,跳出循环体.不管是哪种循环,一旦在循环体中遇到break,系统将完全结束该循环 在Java中是的标签定义,标签就是一个紧跟着英文冒号(:)的标识符 代码 ...

  7. 【DB2】报错:-30090 25000 指定的操作对远程执行失败

    场景描述: 数据库:DB_1,DB_2 现在在DB_1中建立NICKNAME为CST_INFO_NICK,并且该别名指向数据库DB_2的CST_INFO表,在DB_1中建立存储过程,该存储过程需要  ...

  8. C语言文件操作函数大全(超详细)

    C语言文件操作函数大全(超详细) 作者: 字体:[增加 减小] 类型:转载 本篇文章是对C语言中的文件操作函数进行了详细的总结分析,需要的朋友参考下   fopen(打开文件)相关函数 open,fc ...

  9. 【方法1】删除Map中Value反复的记录,而且仅仅保留Key最小的那条记录

    介绍 晚上无聊的时候,我做了一个測试题,測试题的大体意思是:删除Map中Value反复的记录,而且仅仅保留Key最小的那条记录. 比如: I have a map with duplicate val ...

  10. linux 设置tomcat快捷启动方式

    在linux下搭建好tomcat之后,每次启动和关闭都要去tomcat的bin目录下执行./startup.sh和./shutdown.sh 这是很不方便的,下面介绍如何像执行ls mv cp等命令一 ...