內容簡介
這是一個小工具外掛,可以讓您在搭配行動裝置支援的情況下混合使用 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.
< ?php
if ( !wp_is_mobile() ) {
echo '
(adsbygoogle = window.adsbygoogle || []).push({});
‘;}
else {
$myMobileAdsenseClient=’ca-mb-pub-xxxxxxxxxxxx’;
$myMobileAdsenseSlot=’xxxxxxxxxx’;
}?>
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].
