来源1:http://www.graphicrating.com/2009/01/18/my-wordpress-cheat-sheet/

来源2:http://www.cnblogs.com/asqq/archive/2012/12/26/2833487.html

主题结构

 header.php - header section
 index.php - main section
 sidebar.php - sidebar section
 footer.php - footer section
 single.php - post template
 page.php - page template
 comments.php - comments template
 search.php - search content
 searchform.php - search form
 archive.php - archive
 functions.php - special functions
 404.php - error page

循环

 <?php if(have_posts()) : ?>
    <?php while(have_posts()) : the_post(); ?>
 // Custom HTML & PHP code
    <?php endwhile; ?>
 <?php else : ?>
 <?php endif; ?>

包含标签

 < ?php get_header(); ?>
 < ?php get_sidebar(); ?>
 < ?php get_footer(); ?>
 < ?php comments_template(); ?>

网站信息

 < ?php bloginfo('name'); ?> - Title of the blog
 < ?php bloginfo('charset'); ?> - Displays the character set
 < ?php bloginfo('description'); ?> - Displays the description of the blog
 < ?php bloginfo('url'); ?> - Displays the address of the blog
 < ?php bloginfo('rss2_url'); ?> - Displays the RSS URL
 < ?php bloginfo('template_url'); ?> - Displays the URL of the template
 < ?php bloginfo('pingback_url'); ?> - Displays the pingback URL
 < ?php bloginfo('stylesheet_url'); ?> - Displays the URL for the template's CSS file
 < ?php bloginfo('wpurl'); ?> - Displays URL for WordPress installation
 < ?php bloginfo('name'); ?>

判断

 is_home() - when the user is on the home page(blog)
 is_front_page() - when the user is on the home page (blog or page)
 is_single - when a single post is displayed
 is_sticky() - check if a post is sticky
 is_page() - when a page is displayed
 is_category() - when a category is displayed

常用标签

 < ?php the_time() ?> - Displays the time of the current post
 < ?php the_date() ?> - Displays the date of a post or set of posts
 < ?php the_title(); ?> - Displays or returns the title of the current post
 < ?php the_permalink() ?> - Displays the URL for the permalink
 < ?php the_category() ?> - Displays the category of a post
 < ?php the_author(); ?> - Displays the author of the post
 < ?php the_ID(); ?> - Displays the numeric ID of the current post
 < ?php wp_list_pages(); ?> - Displays all the pages
 < ?php wp_tag_cloud(); ?> - Displays a tag cloud
 < ?php wp_list_cats(); ?> - Displays the categories
 < ?php get_calendar(); ?> - Displays the calendar
 < ?php wp_get_archives() ?> - Displays a date-based archives list
 < ?php posts_nav_link(); ?> - Displays Previous page and Next Page links
 < ?php next_post_link() ?> - Displays Newer Posts link
 < ?php previous_post_link() ?> - Displays previous link

导航菜单

栏目页面
 <ul id="menu">
 <li <?php if(is_home()) { ?> class="current-cat"< ?php } ?>>
 <a href="<?php bloginfo('home'); ?>">Home</a></li>
 < ?php wp_list_categories('title_li=&orderby=id'); ?>
 </ul>
page页面
 <ul id="menu">
 <li <?php if(is_home()) { ?> class="current_page_item"< ?php } ?>>
 <a href="<?php bloginfo('home'); ?>">home</a></li>
 < ?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
 </ul>

新增

wordpress-标签的更多相关文章

  1. 为 WordPress 标签添加 rel="nofollow" 属性

    WordPress 标签默认并无 rel="nofollow" 属性.rel="nofollow" 属性的作用是:告诉搜索引擎,无需追踪目标页,禁止蜘蛛爬行和传 ...

  2. 修改WordPress标签云字体大小颜色及标签显示数量

    WordPress 自带的标签云是一个很实用的小工具.站长可以通过标签对具有相同关健词的文章进行检索分类,利于访客查找相关文章.WordPress 默认标签云的字体最小为8pt,最大为22pt,标签显 ...

  3. 让wordpress标签云显示文章数的正确方法

    先看一下效果 在百度经验找到一个教程,可惜,根据实践发现方法是错误的, 百度经验上的代码: 1 2 3 4 5 6 7 8 9 10 11 12 //标签tag所包含的文章数量 function Ta ...

  4. WordPress修改标签云大小及颜色

    修改WordPress标签字体大小: 在cpanel面板中依次打开「wp-includes」→「category-template.php」,找到wp_tag_cloud, 1 2 3 4 5 6 7 ...

  5. wordpress模板各文件函数解析

    修改主题时发现好多WordPress主题函数都不了解,因此网上摘抄了一份放在自己博客上,便于以后好找. 在WordPress中如何按你的意愿显示页面,关键看你是否了解WordPress主题模板页面.这 ...

  6. wordpress 获取分类ID,分类标题,分类描述,分类链接url函数

    get_cat_ID()    根据分类名称获取分类ID   ///// get_cat_name()    根据分类ID获取分类名称 用法:<?phpget_cat_ID( $cat_name ...

  7. 代码实现wordpress彩色标签云的最简单的方法

    首先在wordpress主题文件夹内找到并用编辑器打开 functions.php 文件,随意找个位置不到插到别的函数里,“?>” 之前加入以下代码: //彩色标签云 function colo ...

  8. 如何在一小时内更新100篇文章?-Evernote Sync插件介绍

    上一篇"手把手教你制作微信小程序,开源.免费.快速搞定",已经教会你如何快速制作一个小程序,但作为资讯类小程序,内容不可少,并且还需要及时更新. 但是,如果让你复制粘贴,可能还需要 ...

  9. W​o​r​d​P​r​e​s​s​常​用​标​签​和​调​用​总​结

    调用头部模板<?php get_header();?> 调用尾部模板<?php get_footer();?> 调用侧边栏<?php get_sidebar();?> ...

  10. 为wordpress添加Canonical标签

    在 WordPress 2.9 之前,让 WordPress 博客支持 Canonical 标签是需要通过插件或者手工修改主题的 header.php 文件来实现.如在主题中加如下的代码: <? ...

随机推荐

  1. 河南多校大一训练赛 D

    题目链接:http://acm.hust.edu.cn/vjudge/contest/125004#problem/D 密码:acm Description If an integer is not ...

  2. Spring的事务传播机制

    1.事务传播类型     新建事务 required required_new   - 挂起当前    非事务方式运行 supports not_supported  - 挂起当前 never    ...

  3. Redis 密码设置和登录

    Redis 一般在生产环境中,大家都不使用密码,为了确保安全,都是在防火墙上对redis端口做IP白名单的 我是个技术控,我非得了解一下密码这回事[虽然以后不会用到,呵呵] 好了,废话不多说,简单介绍 ...

  4. 【嵌入式linux】(第三步):安装串口终端 (ubuntu安装minicom串口终端)

    1.前言 我使用的是USB转串口,芯片是PL2303,貌似ubuntu自带了PL2303的USB驱动,可以直接使用,其它的USB转串口的没试过. 2.minicom安装 在终端中输入 : sudo a ...

  5. mysql导出表结构

    在命令行下mysql的数据导出有个很好用命令mysqldump,它的参数有一大把,可以这样查看: mysqldump 最常用的: mysqldump -uroot -pmysql databasefo ...

  6. Android ---paint类

    引自:http://www.cnblogs.com/-OYK/archive/2011/10/25/2223624.html Android Paint和Color类   要绘图,首先得调整画笔,待画 ...

  7. ListView下拉刷新、上拉载入更多之封装改进

    在Android中ListView下拉刷新.上拉载入更多示例一文中,Maxwin兄给出的控件比较强大,前面有详细介绍,但是有个不足就是,里面使用了一些资源文件,包括图片,String,layout,这 ...

  8. Robot Framework的环境搭建

    1.Robot framework的安装 作用:web自动化测试框架. RF框架是基于python 的,所以一定要有python环境.网上可以自行查找. 下载地址:https://pypi.pytho ...

  9. PowerDesigner设置线风格(直线,折线。。。)

    PowerDesigner中的绘图功能真是不敢恭维. 1.修改显示设置 Tools-->Display Preferences 这里有很多表现设置,我们需要的在Format菜单下. 点Modif ...

  10. JS检测图片的大小

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> < ...