WordPress主题链接函数—— Link Template Tags

Link Template Tags 中函数的作用是在WordPress主题中生成相关链接,包括 Edit Post 链接、 Edit Comment 链接、Page 链接、Yearly Archive URL 、Monthly Archive  URL、Daily Archive URL 、Previous Post Links。

一. Edit Post 链接——在用户登录的情况下,显示文章编辑链接

语法:<?php edit_post_link(‘link’, ’before’, ’after’); ?>

参数说明:

  • link:链接文本,默认值为 Edit This,例:<?php edit_post_link(‘Edit’, ’before’, ’after’); ?>。
  • before:链接文本前导符,默认值为空,例:<?php edit_post_link(‘link’, ’&raquo;’, ’after’); ?>
  • after:链接文本后导符,默认值为空,例:<?php edit_post_link(‘link’, ’before’, ’&laquo;’); ?>

二. Edit Comment 链接——在用户登录的情况下,显示评论编辑链接

语法:<?php edit_comment_link(‘link’, ’before’, ’after’); ?>

参数说明:

  • link:链接文本,默认值为 Edit This,例:<?php edit_comment_link(‘Edit’, ’before’, ’after’); ?>
  • before:链接文本前导符,默认值为空,例:<?php edit_comment_link(‘link’, ’&raquo;’, ’after’); ?>
  • after:链接文本后导符,默认值为空,例:<?php edit_comment_link(‘link’, ’before’, ’&laquo;’); ?>

三. Page Links——页面导航链接

语法:<?php wp_page_links(‘arguments’); ?>

参数说明:

  • before:整个页面链接的前导符,默认值为<p>Pages:,例:<?php wp_page_links(‘before=<div>’); ?>
  • after:整个页面链接的后导符,默认值为</p>,例:<?php wp_page_links(‘after=</div>’); ?>
  • next_or_number:是否使用页码,参数范围 [number | next],例:<?php wp_page_links(‘next_or_number=next’); ?>
  • nextpagelink:下一页链接文本,默认值为Next page,例:<?php wp_page_links(‘nextpagelink=Next’); ?>
  • previouspagelink:前一页链接文本,默认值为Previous page,例:<?php wp_page_links(‘previouspagelink=Previous’); ?>
  • pagelink:链接格式,%代表页码,例:<?php wp_page_links(‘pagelink=[%]‘); ?>
  • more_file:链接指向的页面,默认只向当前页面,例:<?php wp_page_links(‘more_file=more.php’); ?>

四. Yearly Archive URL —— 年份归档链接,供PHP调用

语法:<?php get_year_link(‘year’); ?>

参数说明:默认值为当前年份,例:<?php get_year_link(’2003′); ?>

五. Monthly Archive URL——年份/月份归档链接,供PHP调用

语法:<?php get_month_link(‘year’,'month’); ?>

参数说明:

year:年份;month:月份

例:<?php get_month_link(’2003′,’month’); ?> <?php get_month_link(’2003′,’month’); ?>

六. Daily Archive URL 按天归档文件链接,供PHP 调用

语法:<?php get_day_link(‘year’,'month’,'day’); ?>

参数说明:

year:年份;month:月份;day:天

例:<?php get_day_link(‘year’,'month’,’23′); ?>

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

:wink: :-| :-x :twisted: :) 8-O :( :roll: :-P :oops: :-o :mrgreen: :lol: :idea: :-D :evil: :cry: 8) :arrow: :-? :?: :!:

无觅相关文章插件,快速提升流量

任鸟飞网页设计博客 谜题推理 No.1 Web Design Gallery IndustryIdea LookForDesign AWebGallery Mobile Web Template iDesign Wallpaper Big Funny Picture iPhone Faves iPhone Mobi iPad Faves Android Faves BlackBerry Faves Best Design Magazine All Banner Templates Blog Earn Tips 是谁啊 只爱美人 家乡美 唯美爱 美人衣妆 AutoCAD 2D | Pro/E 3D江苏名企The HTML5 Templates