Bez popisu

restricted-taxonomy.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. get_header(); ?>
  3. <div class="wrap">
  4. <?php if ( have_posts() ) : ?>
  5. <header class="page-header">
  6. <?php
  7. the_archive_title( '<h1 class="page-title">', '</h1>' );
  8. the_archive_description( '<div class="taxonomy-description">', '</div>' );
  9. ?>
  10. </header><!-- .page-header -->
  11. <?php endif; ?>
  12. <div id="primary" class="content-area">
  13. <main id="main" class="site-main" role="main">
  14. <?php if ( is_tag() ) {
  15. $tag_id = get_query_var( 'tag_id' );
  16. if ( ! empty( $tag_id ) ) {
  17. $restriction = get_term_meta( $tag_id, 'um_content_restriction', true );
  18. }
  19. } elseif ( is_category() ) {
  20. $um_category = get_category( get_query_var( 'cat' ) );
  21. if ( ! empty( $um_category->term_id ) ) {
  22. $restriction = get_term_meta( $um_category->term_id, 'um_content_restriction', true );
  23. }
  24. } elseif ( is_tax() ) {
  25. $tax_name = get_query_var( 'taxonomy' );
  26. $term_name = get_query_var( 'term' );
  27. $term = get_term_by( 'slug', $term_name, $tax_name );
  28. if ( ! empty( $term->term_id ) ) {
  29. $restriction = get_term_meta( $term->term_id, 'um_content_restriction', true );
  30. }
  31. }
  32. if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
  33. $restricted_global_message = UM()->options()->get( 'restricted_access_message' );
  34. $message = stripslashes( $restricted_global_message );
  35. } elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
  36. $message = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
  37. }
  38. // translators: %s: Restricted taxonomy message.
  39. printf( __( '%s', 'ultimate-member' ), $message ); ?>
  40. </main><!-- #main -->
  41. </div><!-- #primary -->
  42. <?php get_sidebar(); ?>
  43. </div><!-- .wrap -->
  44. <?php get_footer();