{"id":10393,"date":"2010-09-13T19:52:29","date_gmt":"2010-09-13T19:52:29","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/post-index-helpers\/"},"modified":"2025-04-20T06:08:01","modified_gmt":"2025-04-20T06:08:01","slug":"post-index-helpers","status":"publish","type":"plugin","link":"https:\/\/tah.wordpress.org\/plugins\/post-index-helpers\/","author":3606,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.4.5","stable_tag":"1.4.5","tested":"6.8.5","requires":"2.8","requires_php":"","requires_plugins":null,"header_name":"Post Index Helpers","header_author":"Scott Reilly","header_description":"","assets_banners_color":"2c75a0","last_updated":"2025-04-20 06:08:01","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/www.paypal.com\/cgi-bin\/webscr?cmd=_s-xclick&hosted_button_id=6ARCFJ9TX3522","header_plugin_uri":"https:\/\/coffee2code.com\/wp-plugins\/post-index-helpers\/","header_author_uri":"https:\/\/coffee2code.com\/","rating":0,"author_block_rating":0,"active_installs":10,"downloads":5550,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":{"1.0":{"tag":"1.0","author":"coffee2code","date":"2010-09-13 19:52:29"},"1.0.1":{"tag":"1.0.1","author":"coffee2code","date":"2011-02-12 20:26:09"},"1.0.2":{"tag":"1.0.2","author":"coffee2code","date":"2011-02-24 22:32:39"},"1.0.3":{"tag":"1.0.3","author":"coffee2code","date":"2011-07-02 06:01:31"},"1.1":{"tag":"1.1","author":"coffee2code","date":"2011-12-13 20:38:49"},"1.1.1":{"tag":"1.1.1","author":"coffee2code","date":"2012-06-25 05:15:11"},"1.1.2":{"tag":"1.1.2","author":"coffee2code","date":"2012-12-09 08:38:41"},"1.2":{"tag":"1.2","author":"coffee2code","date":"2014-01-06 21:56:54"},"1.2.1":{"tag":"1.2.1","author":"coffee2code","date":"2014-08-27 06:03:17"},"1.2.2":{"tag":"1.2.2","author":"coffee2code","date":"2015-02-12 07:02:23"},"1.2.3":{"tag":"1.2.3","author":"coffee2code","date":"2015-08-08 07:02:03"},"1.2.4":{"tag":"1.2.4","author":"coffee2code","date":"2016-04-13 22:55:16"},"1.2.5":{"tag":"1.2.5","author":"coffee2code","date":"2017-02-08 06:59:44"},"1.2.6":{"tag":"1.2.6","author":"coffee2code","date":"2018-05-28 08:36:47"},"1.2.7":{"tag":"1.2.7","author":"coffee2code","date":"2019-03-02 06:30:29"},"1.2.8":{"tag":"1.2.8","author":"coffee2code","date":"2019-06-17 05:41:06"},"1.2.9":{"tag":"1.2.9","author":"coffee2code","date":"2019-12-24 07:41:46"},"1.3":{"tag":"1.3","author":"coffee2code","date":"2020-05-29 06:36:00"},"1.4":{"tag":"1.4","author":"coffee2code","date":"2020-08-26 06:36:45"},"1.4.1":{"tag":"1.4.1","author":"coffee2code","date":"2021-04-16 07:35:47"},"1.4.2":{"tag":"1.4.2","author":"coffee2code","date":"2021-10-03 07:17:56"},"1.4.3":{"tag":"1.4.3","author":"coffee2code","date":"2023-08-15 23:09:54"},"1.4.4":{"tag":"1.4.4","author":"coffee2code","date":"2024-08-11 06:12:07"},"1.4.5":{"tag":"1.4.5","author":"coffee2code","date":"2025-04-20 06:08:01"}},"upgrade_notice":{"1.4.5":"<p>Trivial update: noted compatibility through WP 6.8+ and PHP 8.3+, and updated copyright date (2025)<\/p>","1.4.4":"<p>Trivial update: noted compatibility through WP 6.6+, removed unit tests from release packaging, and updated copyright date (2024)<\/p>","1.4.3":"<p>Trivial update: noted compatibility through WP 6.3+ and updated copyright date (2023)<\/p>","1.4.2":"<p>Trivial update: added DEVELOPER-DOCS.md, noted compatibility through WP 5.8+, and minor reorganization and tweaks to unit tests<\/p>","1.4.1":"<p>Trivial update: noted compatibility through WP 5.7+ and updated copyright date (2021)<\/p>","1.4":"<p>Trivial update: Added support for action invocation of <code>c2c_the_index()<\/code>, restructured unit test file structure, added a TODO.md file, and noted compatibility through WP 5.5+.<\/p>","1.3":"<p>Minor update: Changed <code>c2c_the_index()<\/code> to echo empty string if index is invalid, prevented warning if invalid argument is sent to `c2c_get_the_index(), updated a few URLs to be HTTPS, and noted compatibility through WP 5.4+<\/p>","1.2.9":"<p>Trivial update: noted compatibility through WP 5.3+ and updated copyright date (2020)<\/p>","1.2.8":"<p>Trivial update: created CHANGELOG.md to store historical changelog outside of readme.txt, modernized unit tests, noted compatibility through WP 5.2+<\/p>","1.2.7":"<p>Trivial update: noted compatibility through WP 5.1+ and updated copyright date (2019)<\/p>","1.2.6":"<p>Trivial update: added README.md, noted compatibility through WP 4.9+, and updated copyright date (2018)<\/p>","1.2.5":"<p>Trivial update: tweaked readme, changed unit test bootstrap, noted compatibility through WP 4.7+, and updated copyright date<\/p>","1.2.4":"<p>Trivial update: minor unit test tweaks, noted compatibility through WP 4.4+, and updated copyright date<\/p>","1.2.3":"<p>Trivial update: noted compatibility through WP 4.3+<\/p>","1.2.2":"<p>Trivial update: noted compatibility through WP 4.1+ and updated copyright date<\/p>","1.2.1":"<p>Trivial update: noted compatibility through WP 4.0+; minor documentation tweaks; added plugin icon<\/p>","1.2":"<p>Recommended minor update: fixed a few small bugs; added unit tests; noted compatibility through WP 3.8+<\/p>","1.1.2":"<p>Trivial update: noted compatibility through WP 3.5+<\/p>","1.1.1":"<p>Trivial update: noted compatibility through WP 3.4+; explicitly stated license<\/p>","1.1":"<p>Minor update: added new function c2c_is_post_in_loop() and noted compatibility through WP 3.3+<\/p>","1.0.3":"<p>Trivial update: noted compatibility through WP 3.2+<\/p>","1.0.2":"<p>Trivial update: add link to plugin homepage to description in readme.txt<\/p>","1.0.1":"<p>Trivial update: noted compatibility with WP 3.1+ and updated copyright date.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":973752,"resolution":"128x128","location":"assets","locale":""}},"assets_banners":{"banner-772x250.png":{"filename":"banner-772x250.png","revision":834120,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.0.1","1.0.2","1.0.3","1.1","1.1.1","1.1.2","1.2","1.2.1","1.2.2","1.2.3","1.2.4","1.2.5","1.2.6","1.2.7","1.2.8","1.2.9","1.3","1.4","1.4.1","1.4.2","1.4.3","1.4.4","1.4.5"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1403,526,3705,86,12040],"plugin_category":[],"plugin_contributors":[78189],"plugin_business_model":[],"class_list":["post-10393","plugin","type-plugin","status-publish","hentry","plugin_tags-index","plugin_tags-loop","plugin_tags-position","plugin_tags-post","plugin_tags-template-tags","plugin_contributors-coffee2code","plugin_committers-coffee2code"],"banners":{"banner":"https:\/\/ps.w.org\/post-index-helpers\/assets\/banner-772x250.png?rev=834120","banner_2x":false,"banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/post-index-helpers\/assets\/icon-128x128.png?rev=973752","icon_2x":false,"generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>This plugin provides thirteen handy template tags that relate to the index\/position of a post within a loop's listing of posts.<\/p>\n\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\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\n<p>Other functions help you get a post (or posts) at a given position in the current loop:<\/p>\n\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\n<p>While the remaining three functions relate to index information about the loop in general:<\/p>\n\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\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\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\n<p>Links: <a href=\"https:\/\/coffee2code.com\/wp-plugins\/post-index-helpers\/\">Plugin Homepage<\/a> | <a href=\"https:\/\/wordpress.org\/plugins\/post-index-helpers\/\">Plugin Directory Page<\/a> | <a href=\"https:\/\/github.com\/coffee2code\/post-index-helpers\/\">GitHub<\/a> | <a href=\"https:\/\/coffee2code.com\">Author Homepage<\/a><\/p>\n\n<h3>Developer Documentation<\/h3>\n\n<p>Developer documentation can be found in <a href=\"https:\/\/github.com\/coffee2code\/post-index-helpers\/blob\/master\/DEVELOPER-DOCS.md\">DEVELOPER-DOCS.md<\/a>. That documentation covers the numerous template tags provided by the plugin.<\/p>\n\n<p>As an overview, these are the template tags provided the plugin:<\/p>\n\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, ...)<\/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, ...)<\/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's index<\/li>\n<\/ul>\n\n<!--section=installation-->\n<ol>\n<li>Install via the built-in WordPress plugin installer. Or download and unzip <code>post-index-helpers.zip<\/code> inside the plugins directory for your site (typically <code>wp-content\/plugins\/<\/code>)<\/li>\n<li>Activate the plugin through the 'Plugins' admin menu in WordPress<\/li>\n<li>Use one or more of the provided template tags in theme template file(s) as desired<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>1.4.5 (2025-04-19)<\/h4>\n\n<ul>\n<li>Change: Note compatibility through WP 6.8+<\/li>\n<li>Change: Note compatibility through PHP 8.3+<\/li>\n<li>Change: Update copyright date (2025)<\/li>\n<li>Unit tests:\n\n<ul>\n<li>Change: Explicitly define return type for overridden methods<\/li>\n<li>New: Add <code>composer.json<\/code> for PHPUnit Polyfill dependency (supposed to have been added in v1.4.4)<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h4>1.4.4 (2024-08-10)<\/h4>\n\n<ul>\n<li>Change: Note compatibility through WP 6.6+<\/li>\n<li>Change: Update copyright date (2024)<\/li>\n<li>New: Add <code>.gitignore<\/code> file<\/li>\n<li>Change: Reduce number of 'Tags' from <code>readme.txt<\/code><\/li>\n<li>Change: Remove development and testing-related files from release packaging<\/li>\n<li>Unit tests:\n\n<ul>\n<li>Hardening: Prevent direct web access to <code>bootstrap.php<\/code><\/li>\n<li>Allow tests to run against current versions of WordPress<\/li>\n<li>New: Add <code>composer.json<\/code> for PHPUnit Polyfill dependency<\/li>\n<li>Change: In bootstrap, store path to plugin directory in a constant<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h4>1.4.3 (2023-04-29)<\/h4>\n\n<ul>\n<li>Change: Note compatibility through WP 6.3+<\/li>\n<li>Change: Update copyright date (2023)<\/li>\n<li>Fix: Fix typo for link to DEVELOPER-DOCS.md in README.md<\/li>\n<\/ul>\n\n<p><em>Full changelog is available in <a href=\"https:\/\/github.com\/coffee2code\/post-index-helpers\/blob\/master\/CHANGELOG.md\">CHANGELOG.md<\/a>.<\/em><\/p>","raw_excerpt":"A variety of template tags related to the index\/position of a post within a loop&#039;s listing of posts.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/10393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"author":[{"embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/users\/3606"}],"replies":[{"embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=10393"}],"wp:attachment":[{"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=10393"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=10393"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=10393"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=10393"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=10393"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=10393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}