前言介紹
- 這款 WordPress 外掛「Byte's PHP Code Widget」是 2013-11-11 上架。
- 目前有 10 個安裝啟用數。
- 上一次更新是 2013-11-12,距離現在已有 4191 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.4 以上版本才可以安裝。
- 有 1 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
php | eval | widget | execute |
內容簡介
這是一個小工具外掛,可以讓您在搭配行動裝置支援的情況下混合使用 PHP 和 HTML 代碼。
外掛提供兩個文字區塊,第一個是標題,第二個名為「代碼:」可混合使用 PHP 和 HTML。兩個勾選方塊可讓您選擇在文章前和/或後使用。沒有小工具數量限制。
WordPress 3.4 版本及更高版本定義了一個名為 wp_is_mobile() 的函式。
這可以用於您的代碼混合中,如果瀏覽器為行動裝置,則可執行某些操作。行動裝置支援通過 wp_is_mobile() 函式實現,該函式返回 true 表示為行動裝置瀏覽器。有關更多信息,請參閱 WordPress API。
動態標題支援意味著您可以使用標題欄位命名小工具,而不會在輸出中顯示。這對於給小工具取有意義的名稱以便跟踪小工具的內容非常有用。
已定義兩個變數,供 Google Mobile Adsense 使用:
$myMobileAdsenseCode;
$myMobileAdsenseSlot;
此小工具需要一些 PHP 和 HTML 編程知識。濫用可能會導致您的網站崩潰或對 Adsense 造成錯誤。
示例:
輸出:
5
要使用 Google 手機版 AdSense,請在「代碼:」區域中包含以下內容:
插件會處理剩下的內容。插件將做另一個檢查,以確保插件內部 wp_is_mobile 為 true,並且 Google Adsense 變數有值。
您可以結合常規和行動版 AdSense。但要小心使用。
以下片段將顯示行動版或常規版廣告,具體取決於最終用戶使用的瀏覽器。
< ? php
if (!wp_is_mobile()) {
echo ‚
(adsbygoogle = window.adsbygoogle || [])。push({});
„;}
else {
$ myMobileAdsenseClient ='ca-mb-pub-xxxxxxxxxxxx';
$ myMobileAdsenseSlot ='xxxxxxxxxx';
}?>
排序列表:
混合使用 PHP 和 HTML 的支持
支援行動裝置瀏覽器
支援 Google Adsense,包括行動裝置
包括「文章前」支援
包括「文章後」支援
沒有小工具數量限制
在側邊欄中包括動態標題支援
無序列表:
混合使用 PHP 和 HTML 的支持
支援行動裝置瀏覽器
支援 Google Adsense,包括行動裝置
包括支援「文章前」
包括支援「文章後」
沒有小工具數量限制
包括側邊欄中的動態標題支援
鏈接到 [WordPress](https://wordpress.org/ \”Your favorite software\”) 和 [Markdown 的語法說明][markdown syntax]。
原文外掛簡介
This is a widget plugin that allow’s you to mix PHP and html code with mobile
support. Two text area’s are provided. The first is the standard “Title”.
The one named “Code:” can mix PHP and html. Two checkboxes allow you to choose
before and/or after posts. No limit on the number of widgets.
WordPress version 3.4 and higher has defined a function called wp_is_mobile().
This can be used inside your code mix to perform certain actions if the
browser is mobile. Mobile support is via wp_is_mobile() function which returns
true if on a mobile browser. See the WordPress API for more information.
Dynamic title support means that you can name your widget using the title
field and not have it displayed in the output. This is useful to give
your widgets meaningful names so you don’t lose track of what is going
on with your widgets.
Two variables have been defined for use with Google Mobile Adsense:
$myMobileAdsenseCode;
$myMobileAdsenseSlot;
This widget requires some knowledge of PHP and HTML coding. Misuse could crash
your site or cause errors with Adsense.
Examples:
Output:
5
To use Google mobile adsense include the following in the “Code:” area:
The plugin will take care of the rest. Another check is made to ensure
that wp_is_mobile is true inside the plugin and that the Google Adsense variable
has a value.
You can combine both regular and mobile adsense. Be careful.
The following snippet will either show mobile or regular ads depending on the
browswer used by the end-user.
Ordered list:
Support for the mixing of PHP and HTML
Support for mobile browsers
Support for Google Adsense including mobilie
Includes “before post” support
Includes “after post” support
No limit on the number of widgets
Includes dynamic title support in sidebars
Unordered list:
Support for the mixing of PHP and HTML
Support for mobile browsers
Support for Google adsense including mobile
Includes support for “before post”
Includes support for “after post”
No limit on the number of widgets
Include dynamic title support in sidebars
Link to [WordPress](https://wordpress.org/ \”Your favorite software\”) and one to [Markdown\’s Syntax Documentation][markdown syntax].
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Byte's PHP Code Widget」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
Eval PHP 》這個外掛可以在文章和博客數據中添加原生的 PHP 代碼。對於已登錄的用戶,會顯示 PHP 錯誤信息,以便調試 PHP 代碼。每個代碼塊都會像 PHP 函數一樣運行。可...。
Admin PHP Eval 》這個外掛允許你在 WordPress 管理介面中(進入「工具」->「管理 PHP 評估」)編輯和儲存多個 PHP 腳本,以eval()函數重複執行。在評估後,會顯示回傳值和...。