Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimcoleman/e63871bfb7b78b98c64e14e59c14590e to your computer and use it in GitHub Desktop.
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.
<?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