Skip to content

Instantly share code, notes, and snippets.

@AbmSourav
Created May 30, 2018 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbmSourav/88b8d5cf95a068d24f305d93b5a7690f to your computer and use it in GitHub Desktop.
Save AbmSourav/88b8d5cf95a068d24f305d93b5a7690f to your computer and use it in GitHub Desktop.
password form is not showing
<?php
$alpha_title_text = 'card-title';
$alpha_content_text = 'card-text';
$alpha_meta_wrap = 'card-footer text-muted';
if ( !is_active_sidebar( 'sidebar-1' ) ) {
$alpha_title_text = 'text-center';
$alpha_content_text = 'text-center';
$alpha_meta_wrap = 'text-center';
}
?>
<p class="<?php echo $alpha_content_text ?>">
<?php echo get_the_excerpt(); ?>
</p>
/**
*======================================
*protected post function
*======================================
*/
function alpha_the_excerpt( $excerpt ){
if ( !post_password_required() ) {
return $excerpt;
}else {
echo get_the_password_form();
}
}
add_filter( "the_excerpt", "alpha_the_excerpt" );
/**
*======================================
*'protected' title change function
*======================================
*/
function alpha_protected_title_change(){
return "%s";
}
add_action( 'protected_title_format', 'alpha_protected_title_change' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment