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 文件来实现.如在主题中加如下的代码: <? ...
随机推荐
- MFC添加背景图片三种方法
方法一: 1.声明成员变量CBrush m_brush;2.在InitDialog中添加代码: ? CBitmap bmp; bmp.LoadBitmap(IDB_BITMAP1); //IDB_B ...
- linux中服务器定时程序设定
服务器不重启的情况下定时自动重启apache及mysql服务,其实也大同小异.具体步骤如下: 一.每天的12点及16点重启apache及mysql服务 [root@www bin]# cd /opt ...
- 链表基础 HDU1267
基础的链表,模拟一下就好了...就签个到
- 7、装饰模式(Decorator)
顾名思义,装饰模式就是给一个对象增加一些新的功能,而且是动态的,要求装饰对象和被装饰对象实现同一个接口,装饰对象持有被装饰对象的实例,关系图如下: Source类是被装饰类,Decorator类是一个 ...
- 安装apk时出现错误Failure [INSTALL_FAILED_DEXOPT]问题解决的方法
在android4.0源码里面编译出来apk后,用adb install (或adb install -r 重装)安装时,报错[INSTALL_FAILED_DEXOPT]. xu@xu-PC:~$ ...
- C# 经典入门15章 RichTextBox
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsEAAAIRCAIAAAAk7fcMAAAgAElEQVR4nOy9+SOU3/////pHuswYyz
- ural1701 Ostap and Partners
Ostap and Partners Time limit: 2.0 secondMemory limit: 64 MB Workman Ivan lost his job. Not because ...
- JAVA实现的截屏程序
http://hadeslee.iteye.com/blog/125386 http://www.jb51.net/article/75114.htm JAVA截屏程序(第三版) JavaEXTSwi ...
- <meta http-equiv="refresh" content="0; url=">
原文:http://www.cnblogs.com/net2/archive/2010/11/29/1890874.html 页面定期刷新,如果加url的,则会重新定向到指定的网页,content后面 ...
- 安装SqlServer2008后vs中dev控件消失
点击红的的