{"id":133080,"date":"2010-09-13T08:00:00","date_gmt":"2010-09-13T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/post-index-helpers\/"},"modified":"2025-04-20T14:08:00","modified_gmt":"2025-04-20T14:08:00","slug":"post-index-helpers","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/post-index-helpers\/","title":{"rendered":"Post Index Helpers"},"content":{"rendered":"<p>This plugin provides thirteen handy template tags that relate to the index\/position of a post within a loop\u2019s listing of posts.<\/p>\n<p>Some of the template tags provided by this plugin relate to the position of the current post within the current loop:<\/p>\n<ul>\n<li><code>c2c_is_first()<\/code><\/li>\n<li><code>c2c_is_last()<\/code><\/li>\n<li><code>c2c_is_at_index()<\/code><\/li>\n<li><code>c2c_is_even()<\/code><\/li>\n<li><code>c2c_is_odd()<\/code><\/li>\n<li><code>c2c_get_the_index()<\/code><\/li>\n<li><code>c2c_is_index_within()<\/code><\/li>\n<li><code>c2c_the_index()<\/code><\/li>\n<\/ul>\n<p>Other functions help you get a post (or posts) at a given position in the current loop:<\/p>\n<ul>\n<li><code>c2c_get_post_by_index()<\/code><\/li>\n<li><code>c2c_get_posts_by_index()<\/code><\/li>\n<\/ul>\n<p>While the remaining three functions relate to index information about the loop in general:<\/p>\n<ul>\n<li><code>c2c_get_last_index()<\/code><\/li>\n<li><code>c2c_is_post_in_loop()<\/code><\/li>\n<li><code>c2c_is_valid_index()<\/code><\/li>\n<\/ul>\n<p>Please see the Template Tags section (in some places found under the Other Notes section) for descriptions of all the functions and their arguments.<\/p>\n<p>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.<\/p>\n<p>Links: <a href=\"https:\/\/coffee2code.com\/wp-plugins\/post-index-helpers\/\" rel=\"nofollow ugc\">Plugin Homepage<\/a> | <a href=\"https:\/\/wordpress.org\/plugins\/post-index-helpers\/\" rel=\"ugc\">Plugin Directory Page<\/a> | <a href=\"https:\/\/github.com\/coffee2code\/post-index-helpers\/\" rel=\"nofollow ugc\">GitHub<\/a> | <a href=\"https:\/\/coffee2code.com\" rel=\"nofollow ugc\">Author Homepage<\/a><\/p>\n<h3>Developer Documentation<\/h3>\n<p>Developer documentation can be found in <a href=\"https:\/\/github.com\/coffee2code\/post-index-helpers\/blob\/master\/DEVELOPER-DOCS.md\" rel=\"nofollow ugc\">DEVELOPER-DOCS.md<\/a>. That documentation covers the numerous template tags provided by the plugin.<\/p>\n<p>As an overview, these are the template tags provided the plugin:<\/p>\n<ul>\n<li><code>c2c_get_last_index()<\/code>     : Gets the index number for the last post in the loop listing<\/li>\n<li><code>c2c_get_post_by_index()<\/code>  : Get post based on specified index<\/li>\n<li><code>c2c_get_posts_by_index()<\/code> : Get posts based on specified array of indexes<\/li>\n<li><code>c2c_get_the_index()<\/code>      : Get the index for the current post<\/li>\n<li><code>c2c_is_at_index()<\/code>        : Is the current index at the specified index?<\/li>\n<li><code>c2c_is_even()<\/code>            : Is the current post at an even position? (i.e. 0, 2, 4, \u2026)<\/li>\n<li><code>c2c_is_first()<\/code>           : Is the current post the first listed post?<\/li>\n<li><code>c2c_is_last()<\/code>            : Is the current post the last listed post?<\/li>\n<li><code>c2c_is_odd()<\/code>             : Is the current post at an odd position? (i.e. 1, 3, 5, \u2026)<\/li>\n<li><code>c2c_is_index_within()<\/code>    : Is the current post (or one at the specified index) within the bounds of a specified range?<\/li>\n<li><code>c2c_is_post_in_loop()<\/code>    : Is the specified post within the current loop?<\/li>\n<li><code>c2c_is_valid_index()<\/code>     : Is the specified index valid?<\/li>\n<li><code>c2c_the_index()<\/code>          : Echo the current post\u2019s index<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>A variety of template tags related to the index\/position of a post within a loop's listing of posts.<\/p>\n","protected":false},"author":65,"featured_media":325248,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Post Index Helpers - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"A variety of template tags related to the index\/position of a post within a loop's listing of posts."},"footnotes":""},"categories":[1],"tags":[633,198,19641,71,14746],"class_list":["post-133080","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-index","tag-loop","tag-position","tag-post","tag-template-tags"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/133080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=133080"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/133080\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/325248"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=133080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=133080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=133080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}