內容簡介
這個外掛增加了一個 shortcode [blog],可以提取和 bloginfo() 函式一樣的相關訊息。使用它非常簡單,並支援與 bloginfo() 一樣的取值。
為什麼使用 shortcode 而不是 PHP 的函式?有時候我需要實現稍微不同的相同網站。這讓我能夠像需要更改的地方一樣在文章內容中傳播這些值,而不用記住每個需要更改的地方。
它的使用方式如下:
[blog info="name"]
這等同於 PHP 中的以下代碼:
bloginfo('name');
這裡有一些示例用法:
[blog info="name"] - 顯示在「設定 > 一般」中設置的「站點標題」。
[blog info="description"] - 顯示在「設定 > 一般」中設置的「標語」。
[blog info="wpurl"] - 顯示在「設定 > 一般」中設置的「WordPress網址」。
[blog info="url"] - 顯示在「設定 > 一般」中設置的「網站地址」。
[blog info="admin_email"] - 顯示在「設定 > 一般」中設置的「電子郵件地址」。
查看這裡以獲取所有可使用的參數:https://codex.wordpress.org/Function_Reference/bloginfo
在這裡另外再啟動一個版本:https://github.com/ethanpil/wp-bloginfo-shortcode
外掛標籤
開發者團隊
原文外掛簡介
This plugin adds a shortcode [blog] to pull info from like the template tag bloginfo(). Its very simple to use and supports the same values as bloginfo().
Why a shortcode and not the function in PHP? Sometimes I need to implement slight variations of the same site. This allows me to have the values propagate into the post content as needed without remembering every place that needs changes.
Its used like this:
[blog info="name"]
This is the equivalent of the following in PHP:
bloginfo('name');
Here are some example uses:
[blog info="name"] - Displays the "Site Title" set in Settings > General.
[blog info="description"] - Displays the "Tagline" set in Settings > General.
[blog info="wpurl"] - Displays the "WordPress address (URL)" set in Settings > General.
[blog info="url"] - Displays the "Site address (URL)" set in Settings > General.
[blog info="admin_email"] - Displays the "E-mail address" set in Settings > General.
See here for all the usable parameters: https://codex.wordpress.org/Function_Reference/bloginfo
Fork away: https://github.com/ethanpil/wp-bloginfo-shortcode
