Guest User

taxonomy-wzkb_category.php

a guest
Jan 5th, 2026
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. <?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase.
  2. /**
  3. * The template for displaying taxonomy archives
  4. *
  5. * Used to display KB section archives if no archive template is found in the theme folder.
  6. *
  7. * If you'd like to further customize the single views, you may create a
  8. * taxonomy-wzkb_category.php file in your theme's folder
  9. *
  10. * @package WebberZone\Knowledge_Base
  11. */
  12.  
  13. global $wp_query;
  14. $wzkb_current_taxonomy = $wp_query->get_queried_object();
  15.  
  16. /* This plugin uses the Archive file of TwentyFifteen theme as an example */
  17. get_header();
  18.  
  19. // Hide the first level header when displaying the category archives.
  20. $wzkb_inline_css = '
  21. .wzkb-section-name-level-1 {
  22. display: none;
  23. }
  24. ';
  25. wp_add_inline_style( 'wz-knowledgebase-styles', $wzkb_inline_css );
  26.  
  27. ?>
  28. <a href="#main" class="skip-link screen-reader-text"><?php esc_html_e( 'Skip to content', 'knowledgebase' ); ?></a>
  29. <div class="wrap wzkb-wrap">
  30. <div id="wzkb-content-primary" class="content-area">
  31. <main id="main" class="site-main" role="main">
  32.  
  33. <?php if ( have_posts() ) : ?>
  34.  
  35. <!-- First, display the breadcrumb -->
  36. <?php wzkb_breadcrumb(); ?>
  37.  
  38. <!-- Then, display the search form -->
  39. <?php wzkb_search_form(); ?>
  40.  
  41. <!-- Now, display the header below the breadcrumb -->
  42. <header class="page-header">
  43. <h1 class="page-title"><?php echo esc_html( $wzkb_current_taxonomy->name ); ?></h1>
  44. </header><!-- .page-header -->
  45.  
  46. <?php
  47. // Display knowledge base content for this category.
  48. $wzkb_knowledge_args = array(
  49. 'category' => $wzkb_current_taxonomy->term_id,
  50. 'extra_class' => 'wzkb-category-archive',
  51. );
  52. echo wzkb_knowledge( $wzkb_knowledge_args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  53.  
  54. // If no content, include the "No posts found" template.
  55. else :
  56. get_template_part( 'content', 'none' );
  57.  
  58. endif;
  59. ?>
  60. </main><!-- .site-main -->
  61. </div><!-- .content-area -->
  62.  
  63. <?php
  64. if ( wzkb_get_option( 'show_sidebar' ) ) {
  65. include_once 'sidebar-primary.php';
  66. }
  67. ?>
  68. </div><!-- .wrap.wzkb-wrap -->
  69.  
  70. <?php
  71. get_footer();
  72.  
Advertisement
Add Comment
Please, Sign In to add comment