Last active
June 16, 2023 17:09
-
-
Save kimcoleman/e63871bfb7b78b98c64e14e59c14590e to your computer and use it in GitHub Desktop.
Override the Advanced Setting to hide excerpts if this is an Addon Package single post.
This file contains hidden or 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 | |
/* | |
* Override the Advanced Setting to hide excerpts if this is an Addon Package single post. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
*/ | |
function option_pmpro_showexcerpts_on_addon_packages( $showexcerpts ) { | |
if ( ! function_exists( 'pmproap_isPostLocked' ) ) { | |
return $showexcerpts; | |
} | |
global $post; | |
if ( ! empty( $post ) && pmproap_isPostLocked( $post->ID ) ) { | |
$showexcerpts = true; | |
} | |
return $showexcerpts; | |
} | |
add_filter( 'option_pmpro_showexcerpts', 'option_pmpro_showexcerpts_on_addon_packages' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment