wordpress-标签
来源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-标签的更多相关文章
- 为 WordPress 标签添加 rel="nofollow" 属性
WordPress 标签默认并无 rel="nofollow" 属性.rel="nofollow" 属性的作用是:告诉搜索引擎,无需追踪目标页,禁止蜘蛛爬行和传 ...
- 修改WordPress标签云字体大小颜色及标签显示数量
WordPress 自带的标签云是一个很实用的小工具.站长可以通过标签对具有相同关健词的文章进行检索分类,利于访客查找相关文章.WordPress 默认标签云的字体最小为8pt,最大为22pt,标签显 ...
- 让wordpress标签云显示文章数的正确方法
先看一下效果 在百度经验找到一个教程,可惜,根据实践发现方法是错误的, 百度经验上的代码: 1 2 3 4 5 6 7 8 9 10 11 12 //标签tag所包含的文章数量 function Ta ...
- WordPress修改标签云大小及颜色
修改WordPress标签字体大小: 在cpanel面板中依次打开「wp-includes」→「category-template.php」,找到wp_tag_cloud, 1 2 3 4 5 6 7 ...
- wordpress模板各文件函数解析
修改主题时发现好多WordPress主题函数都不了解,因此网上摘抄了一份放在自己博客上,便于以后好找. 在WordPress中如何按你的意愿显示页面,关键看你是否了解WordPress主题模板页面.这 ...
- wordpress 获取分类ID,分类标题,分类描述,分类链接url函数
get_cat_ID() 根据分类名称获取分类ID ///// get_cat_name() 根据分类ID获取分类名称 用法:<?phpget_cat_ID( $cat_name ...
- 代码实现wordpress彩色标签云的最简单的方法
首先在wordpress主题文件夹内找到并用编辑器打开 functions.php 文件,随意找个位置不到插到别的函数里,“?>” 之前加入以下代码: //彩色标签云 function colo ...
- 如何在一小时内更新100篇文章?-Evernote Sync插件介绍
上一篇"手把手教你制作微信小程序,开源.免费.快速搞定",已经教会你如何快速制作一个小程序,但作为资讯类小程序,内容不可少,并且还需要及时更新. 但是,如果让你复制粘贴,可能还需要 ...
- WordPress常用标签和调用总结
调用头部模板<?php get_header();?> 调用尾部模板<?php get_footer();?> 调用侧边栏<?php get_sidebar();?> ...
- 为wordpress添加Canonical标签
在 WordPress 2.9 之前,让 WordPress 博客支持 Canonical 标签是需要通过插件或者手工修改主题的 header.php 文件来实现.如在主题中加如下的代码: <? ...
随机推荐
- ubuntu apache2 流量限制模块
mod-bw is an Apache 2 module provided to solve the problem of limiting users’ and virtual hosts’ ban ...
- Chapter 1 First Sight——23
I stared because their faces, so different, so similar, were all devastatingly, inhumanly beautiful. ...
- 阅读android项目源码
版权声明:欢迎转载,转载请注明出处;http://blog.csdn.net/angcyo 上一篇,我们成功导入并运行了 贝壳单词 项目. 这篇文章, 带大家一起读一读源码. 打开 贝壳单词 项目,定 ...
- python中uuid来生成机器唯一标识
摘要: 我们可以使用uuid1的后16位来标识一个机器. # use machine specific uuid, last 16 char will be the same if machine ...
- delphi第2节
- 转 Android:sp与dp(densityDpi与scaledDensity)
一般在布局上设置控件大小维度的单位采用dp,而定义字体大小的单位采用sp. dp是dip,density independent pixel,即密度无关的像素单位,说白了,就是这个维度相对于不同屏幕的 ...
- oracle sql 分页
Oracle实现分页时,需要引入一个rownum的函数,rownum可以给记录一个类似于id的字段. 以下收整理了常用的几种sql分页算法,数据库以Oracle中emp为例.查询结果如下: SQL&g ...
- sockaddr结构体
sockaddr 本词条缺少名片图,补充相关内容使词条更完整,还能快速升级,赶紧来编辑吧! 一,用于存储参与(IP)Windows套接字通信的计算机上的一个internet协议(IP)地址.为了统一地 ...
- POJ 2019 Cornfields(二维RMQ)
相比以前的RMQ不同的是,这是一个二维的ST算法 #include<iostream> #include<cstring> #include<cstdio> #in ...
- CSS3中transform几个属性值的注意点
transform(变形)是CSS3中的元素的属性,transform的属性值主要包括旋转rotate.扭曲skew.缩放scale和移动translate以及矩阵变形matrix 基本用法可以参考文 ...