Sketch: Add page password protection for portfolio page (#6012)

* Sketch: Add page password protection for portfolio items on the portfolio page

* Wrap password protection form with the container for consistent styling
This commit is contained in:
Wojtek Naruniec 2022-05-24 19:18:27 +02:00 committed by GitHub
parent 7928eb88df
commit 7a745e2e04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,36 +11,51 @@ get_header(); ?>
<main id="main" class="site-main" role="main">
<?php if ( sketch_has_featured_posts( 1 ) ) : ?>
<div class="featured-content">
<?php get_template_part( 'content-featured' ); ?>
</div>
<div class="featured-content">
<?php get_template_part( 'content-featured' ); ?>
</div>
<?php endif; ?>
<?php if ( ! get_theme_mod( 'sketch_hide_portfolio_page_content' ) ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( post_password_required() ) : ?>
<?php the_title( '<header class="page-header"><h1 class="page-title">', '</h1></header>' ); ?>
<?php the_title( '<header class="page-header"><h1 class="page-title">', '</h1></header>' ); ?>
<div class="page-content">
<?php
the_content();
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'sketch' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
<div class="page-content">
<?php the_content(); ?>
</div><!-- .page-content -->
<?php else : ?>
<?php if ( ! get_theme_mod( 'sketch_hide_portfolio_page_content' ) ) : ?>
<?php
while ( have_posts() ) :
the_post();
?>
<?php edit_post_link( __( 'Edit', 'sketch' ), '<div class="entry-meta"><span class="edit-link">', '</span></div>' ); ?>
</div><!-- .page-content -->
<?php the_title( '<header class="page-header"><h1 class="page-title">', '</h1></header>' ); ?>
<?php endwhile; // end of the loop. ?>
<?php endif; ?>
<div class="page-content">
<?php
the_content();
wp_link_pages(
array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'sketch' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
)
);
?>
<?php edit_post_link( __( 'Edit', 'sketch' ), '<div class="entry-meta"><span class="edit-link">', '</span></div>' ); ?>
</div><!-- .page-content -->
<?php endwhile; // end of the loop. ?>
<?php endif; ?>
<?php
if ( get_query_var( 'paged' ) ) :
$paged = get_query_var( 'paged' );
if ( get_query_var( 'paged' ) ) :
$paged = get_query_var( 'paged' );
elseif ( get_query_var( 'page' ) ) :
$paged = get_query_var( 'page' );
else :
@ -55,27 +70,28 @@ get_header(); ?>
'posts_per_page' => $posts_per_page,
);
$project_query = new WP_Query ( $args );
$project_query = new WP_Query( $args );
if ( $project_query -> have_posts() ) :
?>
if ( $project_query->have_posts() ) :
?>
<div class="projects clear">
<?php
while ( $project_query -> have_posts() ) : $project_query -> the_post();
<?php
while ( $project_query->have_posts() ) :
$project_query->the_post();
get_template_part( 'content', 'portfolio' );
get_template_part( 'content', 'portfolio' );
endwhile;
?>
?>
</div><!-- .projects -->
<?php
sketch_paging_nav( $project_query->max_num_pages );
wp_reset_postdata();
?>
<?php
sketch_paging_nav( $project_query->max_num_pages );
wp_reset_postdata();
?>
<?php else : ?>
@ -98,8 +114,9 @@ get_header(); ?>
</section><!-- .no-results -->
<?php endif; ?>
<?php endif; // end post_password_required() ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_footer(); ?>
<?php get_footer(); ?>