Last active
February 3, 2016 16:29
-
-
Save billerickson/1624451 to your computer and use it in GitHub Desktop.
Manually Curated Related Posts - Pre-Loop Code
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 | |
/** | |
* Related Posts Before Loop | |
* Adds connection data to $wp_query. Run before the loop. | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/manually-curated-related-posts/ | |
*/ | |
function be_related_posts_pre_loop() { | |
// Make Sure plugin is active | |
if ( !function_exists( 'p2p_register_connection_type' ) ) | |
return; | |
global $wp_query; | |
p2p_type( 'related-articles' )->each_connected( $wp_query ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment