- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
テンプレートタグ/the shortlink
このページ「テンプレートタグ/the shortlink」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています。
タグ一覧: テンプレートタグ | インクルードタグ | 条件分岐タグ | その他の関数 | Code Reference
使い方: テンプレートタグ入門 | パラメータの渡し方 | 初心者の方へ | その他のテーマ関連資料
目次
Description
Used on single post permalink pages, this template tag displays a "URL shortening" link for the current post. By default, this will mean the URL has a format of /?p=1234, and will only appear if pretty permalinks are enabled. However, this feature is limited by design and intended to be leveraged by plugins that may offer links in a different format, a custom format, or even a format provided by a third-party URL shortening service.
This tag must be used in The Loop.
Usage
<?php the_shortlink('text', 'title', 'before', 'after'); ?>
Examples
Default Usage
Displays link with "The is the short link." as the text.
<?php the_shortlink(); ?>
Custom Text
Displays link with the specified text.
<?php the_shortlink(__('Shortlinkage FTW')); ?>
Conditional HTML
Displays link with prefix and suffix HTML that will appear only when the shortlink URL is available.
<?php the_shortlink('short link', null, '<ul><li>', '</li></ul>'); ?>
Parameters
- text
- (string) Link text to display. Defaults to "This is the short link."
- title
- (string) Tool-tip text displayed with the link. Defaults to the post title.
- before
- (string) Text or HTML prefix added to the link.
- after
- (string) Text or HTML suffix added to the link.
Source File
the_permalink() is located in wp-includes/link-template.php
.
Change Log
- Since: 3.0.0
最新英語版: WordPress Codex » Template Tags/the_shortlink (最新版との差分)