-
-
Save billerickson/67972e07774176d3b30d2ef3eeaa63e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'genesis_after_entry', 'genesis_add_id_to_global_exclude', 9 ); | |
/** | |
* Modify the global $_genesis_displayed_ids each time a loop iterates. | |
* | |
* Keep track of what posts have been shown on any given page by adding each ID to a global array, which can be used any | |
* time by other loops to prevent posts from being displayed twice on a page. | |
* | |
* @since 2.0.0 | |
* | |
* @global array $_genesis_displayed_ids Array of displayed post IDs. | |
*/ | |
function genesis_add_id_to_global_exclude() { | |
global $_genesis_displayed_ids; | |
$_genesis_displayed_ids[] = get_the_ID(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment