2016年11月19日 17:15
<?php get_header(); ?>
<article>
<header>
<h1><?php the_title(); ?></h1>
</header>
<div><?php the_content(); ?></div>
</article>
<?php get_footer(); ?>
<div><?php the_content(); ?></div>
<?php get_header(); ?>
<article>
<header>
<h1><?php the_title(); ?></h1>
</header>
<?php if( !post_password_required( $post->ID ) ) : ?>
<div><?php the_content(); ?></div>(←実際にはカスタム投稿の内容全部)
<?php else: ?>
<?php echo get_the_password_form(); ?>
<?php endif; ?>
</article>
<?php get_footer(); ?>
<?php get_header(); ?>
<?php if( !post_password_required( $post->ID ) ) : ?>
<article>
<header>
<h1><?php the_title(); ?></h1>
</header>
<div><?php the_content(); ?></div>(←実際にはカスタム投稿の内容全部)
</article>
<?php else: ?>
<?php echo get_the_password_form(); ?>
<?php endif; ?>
<?php get_footer(); ?>
<?php get_header(); ?>
<?php if( !post_password_required( $post->ID ) ) : ?>
<article>
<header>
<h1><?php the_title(); ?></h1>
</header>
<div><?php the_content(); ?></div>
</article>
<?php else: ?>
<?php echo get_the_password_form(); ?>
<?php endif; ?>
<?php get_footer(); ?>
add_filter('protected_title_format', 'remove_protected');
function remove_protected($title) {
return '%s';
}
function custom_postpass_time() {
require_once ABSPATH . 'wp-includes/class-phpass.php';
$hasher = new PasswordHash( 8, true );
setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), time() + HOUR_IN_SECONDS, COOKIEPATH );
wp_safe_redirect( wp_get_referer() );
exit();
}
add_action( 'login_form_postpass', 'custom_postpass_time' );
function custom_post_password_expires() {
return time() + HOUR_IN_SECONDS ;
}
add_filter('post_password_expires', 'custom_post_password_expires' );
$args = array(
'post_type' => 'item',
'posts_per_page' => -1,
'post_status' => 'publish',
'has_password' => false,
'orderby' => 'menu_order',
);