
內容簡介
這個小型外掛可以讓你在文章、頁面和佈景主題檔案中使用類似 {phrase 1|phrase 2|phrase 3} 的 spintax。只需將要處理的內容置於短碼 [wpts_spin] [/wpts_spin] 中,每次頁面載入時都會生成一個獨特的副本。或者,你可以將 spintax 字串傳遞給函數 wpts_spin(),並顯示返回的值。
這個外掛可以幫助你避免重複內容的懲罰。例如,如果你有一大塊需要出現在整個網站上的文本,那麼你可以為其編寫 spintax,並使用上述的短碼或模板標籤來生成獨特的複本。
外掛也支援嵌套的 spintax,例如 {phrase 1|phrase 2|{sub-phrase 1|sub-phrase 2|sub-phrase 3}}。
示例1:
短碼:
[wpts_spin]{phrase 1|phrase 2|phrase 3}[/wpts_spin]
函數:
<?php wpts_spin('{phrase 1|phrase 2|phrase 3}'); ?>
例子輸出:
phrase 1
phrase 2
phrase 3
示例2(嵌套的 spintax):
短碼:
[wpts_spin]{phrase 1|phrase 2|{sub-phrase 1|sub-phrase 2|sub-phrase 3}}[/wpts_spin]
函數:
<?php wpts_spin( '{phrase 1|phrase 2|{sub-phrase 1|sub-phrase 2|sub-phrase 3}}' ); ?>
例子輸出:
phrase 1
sub-phrase 2
示例3(快取):
短碼:
[wpts_spin cache="604800"]{phrase 1|phrase 2|phrase 3}[/wpts_spin]
函數:
<?php wpts_spin( '{phrase 1|phrase 2|phrase 3}', array( 'cache' => '604800' ) ); ?>
例子輸出:
與示例1相同,但輸出會被快取一周(604800秒)。
外掛標籤
開發者團隊
原文外掛簡介
This tiny plugin allows you to use spintax like {phrase 1|phrase 2|phrase 3} in your posts, pages and theme files. Just enclose the content that you want to be processed in the shortcode [wpts_spin][/wpts_spin] and a unique copy will be generated on each page load. Alternatively, you can pass the spintax string to the function wpts_spin() and echo the returned value.
The plugin can help you avoid duplicate content penalties. For instance if you have a sizable block of text that needs to appear throughout the website then you can write spintax for it and use the above-mentioned shortcode or template tag to generate unique copies.
Nested spintax like {phrase 1|phrase 2|{sub-phrase 1|sub-phrase 2|sub-phrase 3}} is also supported by the plugin.
Example 1:
Shortcode:
[wpts_spin]{phrase 1|phrase 2|phrase 3}[/wpts_spin]
Function:
Sample Output:
phrase 1
phrase 2
phrase 3
Example 2 (Nested Spintax):
Shortcode:
[wpts_spin]{phrase 1|phrase 2|{sub-phrase 1|sub-phrase 2|sub-phrase 3}}[/wpts_spin]
Function:
Sample Output:
phrase 1
sub-phrase 2
Example 3 (Caching):
Shortcode:
[wpts_spin cache="604800"]{phrase 1|phrase 2|phrase 3}[/wpts_spin]
Function:
'604800' ) ); ?>
Sample Output:
Same as Example 1 but the output will be cached for a week (604800 seconds).
