Created
November 17, 2014 15:57
-
-
Save Wysija/a5eca247c526445ddb2c to your computer and use it in GitHub Desktop.
Show teaser content to non members for the plugin Groups. Add the code to your theme's functions.php
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
// Show title, excerpt and thumbnail in archives | |
add_action('pre_get_posts', 'my_pre_get_posts'); | |
function my_pre_get_posts() { | |
// If the user is looking at the front page | |
if ( is_archive() || is_category() || is_front_page() ) { | |
// Remove the Groups_Post_Access filters | |
remove_filter( 'posts_where', array( 'Groups_Post_Access', 'posts_where' ), 10, 2 ); | |
remove_filter( 'the_posts', array( 'Groups_Post_Access', 'the_posts' ), 1, 2 ); | |
remove_filter( 'get_the_excerpt', array( 'Groups_Post_Access', 'get_the_excerpt' ), 1 ); | |
remove_filter( 'the_content', array( 'Groups_Post_Access', 'the_content' ), 1 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment