Advertisement
Guest User

templates/search.php

a guest
Mar 29th, 2021
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.06 KB | None | 0 0
  1. <?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
  2.  
  3. /**
  4.  * The template for displaying the 404 page
  5.  */
  6.  
  7. $search_page = get_post( us_get_option( 'search_page' ) );
  8.  
  9. // Output specific page
  10. if ( $search_page ) {
  11.     if ( has_filter( 'us_tr_object_id' ) ) {
  12.         $search_page = get_post( (int) apply_filters( 'us_tr_object_id', $search_page->ID, 'page', TRUE ) );
  13.     }
  14.  
  15.     us_register_context_layout( 'header' );
  16.     get_header();
  17.     // If set custom page load its css
  18.     if ( is_object( $search_page ) ) {
  19.         us_output_design_css( [ $search_page ] );
  20.     }
  21.  
  22.     us_register_context_layout( 'main' );
  23.     ?>
  24.     <main id="page-content" class="l-main"<?php echo ( us_get_option( 'schema_markup' ) ) ? ' itemprop="mainContentOfPage"' : ''; ?>>
  25.  
  26.         <?php
  27.         do_action( 'us_before_page' );
  28.  
  29.         if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
  30.  
  31.             // Titlebar, if it is enabled in Theme Options
  32.             us_load_template( 'templates/titlebar' );
  33.  
  34.             // START wrapper for Sidebar
  35.             us_load_template( 'templates/sidebar', array( 'place' => 'before' ) );
  36.         }
  37.  
  38.         $content_area_id = us_get_page_area_id( 'content' );
  39.  
  40.         if ( $content_area_id != '' AND get_post_status( $content_area_id ) != FALSE ) {
  41.             global $us_is_search_page_block;
  42.             $us_is_search_page_block = TRUE;
  43.             us_load_template( 'templates/content' );
  44.         } else {
  45.             us_open_wp_query_context();
  46.  
  47.             us_add_page_shortcodes_custom_css( $search_page->ID );
  48.  
  49.             us_close_wp_query_context();
  50.  
  51.             // Set search page ID as $us_page_block_id for grid shortcodes
  52.             us_add_to_page_block_ids( $search_page->ID );
  53.  
  54.             echo apply_filters( 'the_content', $search_page->post_content );
  55.  
  56.             us_remove_from_page_block_ids();
  57.         }
  58.  
  59.         if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
  60.             // AFTER wrapper for Sidebar
  61.             us_load_template( 'templates/sidebar', array( 'place' => 'after' ) );
  62.         }
  63.  
  64.         do_action( 'us_after_page' );
  65.         ?>
  66.  
  67.     </main>
  68.     <?php
  69.  
  70.     us_register_context_layout( 'footer' );
  71.     get_footer();
  72.  
  73.     // Output default archive layout
  74. } else {
  75.     us_load_template( 'templates/archive' );
  76. }
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement