| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template used to overwrite the main shop page which is a post type archive |
| 4 |
*/ |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; // Exit if accessed directly |
| 8 |
} |
| 9 |
|
| 10 |
get_header( 'shop' ); ?> |
| 11 |
|
| 12 |
<?php |
| 13 |
/** |
| 14 |
* woocommerce_before_main_content hook. |
| 15 |
* |
| 16 |
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content) |
| 17 |
* @hooked woocommerce_breadcrumb - 20 |
| 18 |
*/ |
| 19 |
do_action( 'woocommerce_before_main_content' ); |
| 20 |
?> |
| 21 |
|
| 22 |
<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?> |
| 23 |
|
| 24 |
<h1 class="page-title"><?php woocommerce_page_title(); ?></h1> |
| 25 |
|
| 26 |
<?php endif; ?> |
| 27 |
|
| 28 |
<?php |
| 29 |
/** |
| 30 |
* Display restriction message |
| 31 |
* |
| 32 |
*/ |
| 33 |
|
| 34 |
$post_id = wc_get_page_id( 'shop' ); |
| 35 |
|
| 36 |
if ($post_id != -1) { |
| 37 |
$shop_post = get_post( $post_id ); |
| 38 |
if( is_user_logged_in() ) { |
| 39 |
$message = wppb_content_restriction_process_content_message( 'logged_in', get_current_user_id(), $post_id ); |
| 40 |
echo do_shortcode( apply_filters( 'wppb_content_restriction_message_logged_in', $message, $shop_post->post_content, $shop_post, get_current_user_id() ) ); |
| 41 |
} |
| 42 |
else{ |
| 43 |
$message = wppb_content_restriction_process_content_message( 'logged_out', get_current_user_id(), $post_id ); |
| 44 |
echo do_shortcode( apply_filters( 'wppb_content_restriction_message_logged_out', $message, $shop_post->post_content, $shop_post, get_current_user_id() ) ); |
| 45 |
} |
| 46 |
} |
| 47 |
?> |
| 48 |
|
| 49 |
<?php |
| 50 |
/** |
| 51 |
* woocommerce_after_main_content hook. |
| 52 |
* |
| 53 |
* @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content) |
| 54 |
*/ |
| 55 |
do_action( 'woocommerce_after_main_content' ); |
| 56 |
?> |
| 57 |
|
| 58 |
<?php |
| 59 |
/** |
| 60 |
* woocommerce_sidebar hook. |
| 61 |
* |
| 62 |
* @hooked woocommerce_get_sidebar - 10 |
| 63 |
*/ |
| 64 |
do_action( 'woocommerce_sidebar' ); |
| 65 |
?> |
| 66 |
|
| 67 |
<?php get_footer( 'shop' ); ?> |
| 68 |
|