
內容簡介
這個外掛提供了十三個與文章在迴圈中的位置相關的有用的樣板標籤。
這個外掛提供的部分樣板標籤與當前迴圈中當前文章的位置相關:
c2c_is_first()
c2c_is_last()
c2c_is_at_index()
c2c_is_even()
c2c_is_odd()
c2c_get_the_index()
c2c_is_index_within()
c2c_the_index()
其他函數可幫助您在當前迴圈中獲取在給定位置的文章(或文章):
c2c_get_post_by_index()
c2c_get_posts_by_index()
而剩下的三個函數則與迴圈的索引信息有關:
c2c_get_last_index()
c2c_is_post_in_loop()
c2c_is_valid_index()
請查看“模板標籤”一節(有時會在其他注意事項部分下找到)以獲取所有函數及其參數的描述。
請注意,索引計數從0開始,這意味著第一個項目的索引為0。索引為-1表示沒有找到文章。
鏈接: 插件主頁 | 插件目錄頁面 | GitHub | 作者主頁
開發者文件
開發人員文件可以在DEVELOPER-DOCS.md中找到。該文件涵蓋了外掛提供的眾多模板標籤。
作為概述,這些是外掛提供的樣板標籤:
c2c_get_last_index() :獲取迴圈中最后一篇文章的索引號
c2c_get_post_by_index() :根據指定的索引獲取文章
c2c_get_posts_by_index() :根據指定的索引數組獲取文章
c2c_get_the_index() :獲取當前文章的索引
c2c_is_at_index() :當前索引是否在指定的索引內?
c2c_is_even() :當前文章是否在偶數位置?(即0、2、4、…)
c2c_is_first() :當前文章是否為列表中的第一篇文章?
c2c_is_last() :當前文章是否為列表中的最后一篇文章?
c2c_is_odd() :當前文章是否在奇數位置?(即1、3、5、…)
c2c_is_index_within() :當前文章(或位於指定索引的文章)是否在指定範圍內?
c2c_is_post_in_loop() :指定的文章是否在當前迴圈中?
c2c_is_valid_index() :指定的索引是否有效?
c2c_the_index() :輸出當前文章的索引
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
This plugin provides thirteen handy template tags that relate to the index/position of a post within a loop’s listing of posts.
Some of the template tags provided by this plugin relate to the position of the current post within the current loop:
c2c_is_first()
c2c_is_last()
c2c_is_at_index()
c2c_is_even()
c2c_is_odd()
c2c_get_the_index()
c2c_is_index_within()
c2c_the_index()
Other functions help you get a post (or posts) at a given position in the current loop:
c2c_get_post_by_index()
c2c_get_posts_by_index()
While the remaining three functions relate to index information about the loop in general:
c2c_get_last_index()
c2c_is_post_in_loop()
c2c_is_valid_index()
Please see the Template Tags section (in some places found under the Other Notes section) for descriptions of all the functions and their arguments.
Note that index counting begins at 0, which means the first item has an index of 0. An index of -1 indicates no posts were found.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Developer Documentation
Developer documentation can be found in DEVELOPER-DOCS.md. That documentation covers the numerous template tags provided by the plugin.
As an overview, these are the template tags provided the plugin:
c2c_get_last_index() : Gets the index number for the last post in the loop listing
c2c_get_post_by_index() : Get post based on specified index
c2c_get_posts_by_index() : Get posts based on specified array of indexes
c2c_get_the_index() : Get the index for the current post
c2c_is_at_index() : Is the current index at the specified index?
c2c_is_even() : Is the current post at an even position? (i.e. 0, 2, 4, …)
c2c_is_first() : Is the current post the first listed post?
c2c_is_last() : Is the current post the last listed post?
c2c_is_odd() : Is the current post at an odd position? (i.e. 1, 3, 5, …)
c2c_is_index_within() : Is the current post (or one at the specified index) within the bounds of a specified range?
c2c_is_post_in_loop() : Is the specified post within the current loop?
c2c_is_valid_index() : Is the specified index valid?
c2c_the_index() : Echo the current post’s index
