调用头部模板
<?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. tomcat环境部署

    环境说明 系统版本     CentOS 7.2 x86_64 软件版本     jdk-8u171 tomcat-8.0.27 1.tomcat介绍及软件包准备 Tomcat是Apache软件基金会 ...

  2. PHP+MYSQL的搭建

    如今准备研究下微信的开发,所以要研究下PHP了,但对这个平台还是非常陌生的,所以网上找了些资料并測试,现贴出来给大家參考. 第一步:我们先下载[PHPStudy 2013]或者最新版本号: 下载地址: ...

  3. MAC下安装Mysql数据库

    步骤一:安装 登录官网:mysql数据库下载官网下载合适的版本 下载完成后,在Finder的侧边栏为下载的目录中,找到下载完成的文档. 单击下载文档,单击MySQL-5.6.22-osx10.8-x8 ...

  4. Windows如何使用主题包

    相信有很多朋友都遇到这样的问题 下载了主题却没有办法安装就是解压到C:\WINDOWS\Resources\Themes也是于事无补 没有任何反应 回到桌面 点击右键还是没有没有任何反应见图一 原因很 ...

  5. zoj 1100 - Mondriaan&#39;s Dream

    题目:在m*n的地板上铺上同样的1*2的地板砖,问有多少种铺法. 分析:dp,组合,计数.经典dp问题,状态压缩. 状态:设f(i,j)为前i-1行铺满,第i行铺的状态的位表示为j时的铺砖种类数: 转 ...

  6. Digg工程师讲述Digg背后的技术

    虽然最近业绩有所下滑,也出现了一些技术故障,但Digg作为首屈一指的社会化新闻网站,其背后的技术还是值得一探,Digg工程师 Dave Beckett 在今年4月份写一篇名为<How Digg ...

  7. asp.net 中点击button弹出模式对话框,选择值后返回到页面中(window.showModalDialog实现)

    <td>现从事专业</td><td>       <asp:TextBox ID="tbMajor" runat="server ...

  8. World Wind Java开发之三 显示状态栏信息

    先来看下本篇博客索要达到的效果: 找到源代码下的gov.nasa.worldwind.util下的StatusBar.java文件,能够看到状态栏显示的信息主要包含视点高度以及相应空间点三维坐标以及是 ...

  9. 初学spring(一)

    1.spring 在ssh 中所处的位置 struts 是web框架(jsp,action,actionform) hibernate 是orm框架,处于数据持久层 spring 是容器框架,配置be ...

  10. 通过 P3P规范让IE跨域接受第三方cookie session

    所谓第三方 cookie,就是说你访问网页 A,却接收到域名 B 的 cookie 设定指令.这可能是由于网页 A 请求或链接了 B 的网页,比如上面提到的 iframe 以及 jsonp. 我查到了 ...