sub-header.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * Site sub-header. Includes a slider, page title, etc.
  4. *
  5. * @package vamtam/consulting
  6. */
  7. $page_title = VamtamFramework::get( 'page_title', null );
  8. if ( ! is_404() ) {
  9. if ( vamtam_has_woocommerce() ) {
  10. if ( is_woocommerce() && ! is_single() ) {
  11. if ( is_product_category() ) {
  12. $page_title = single_cat_title( '', false );
  13. } elseif ( is_product_tag() ) {
  14. $page_title = single_tag_title( '', false );
  15. } else {
  16. $page_title = wc_get_page_id( 'shop' ) ? get_the_title( wc_get_page_id( 'shop' ) ) : '';
  17. }
  18. } elseif ( is_cart() || is_checkout() ) {
  19. $cart_id = wc_get_page_id( 'cart' );
  20. $checkout_id = wc_get_page_id( 'checkout' );
  21. $cart_title = get_the_title( $cart_id );
  22. $checkout_title = get_the_title( $checkout_id );
  23. $complete_title = esc_html__( 'Order Complete', 'vamtam-consulting' );
  24. if ( is_cart() ) {
  25. $checkout_title = '<a href="' . esc_url( get_permalink( $checkout_id ) ) . '" title="' . esc_attr( $checkout_title ) . '">' . $checkout_title . '</a>';
  26. } else {
  27. $cart_title = '<a href="' . esc_url( get_permalink( $cart_id ) ) . '" title="' . esc_attr( $cart_title ) . '">' . $cart_title . '</a>';
  28. }
  29. $cart_state = is_cart() ? 'active' : 'inactive';
  30. $checkout_state = is_checkout() && ! is_order_received_page() ? 'active' : 'inactive';
  31. $complete_state = is_order_received_page() ? 'active' : 'inactive';
  32. $page_title = "
  33. <span class='checkout-breadcrumb'>
  34. <span class='title-part-{$cart_state}'>$cart_title</span>" .
  35. vamtam_get_icon_html( array(
  36. 'name' => 'vamtam-theme-arrow-right-sample',
  37. ) ) .
  38. "<span class='title-part-{$checkout_state}'>$checkout_title</span>" .
  39. vamtam_get_icon_html( array(
  40. 'name' => 'vamtam-theme-arrow-right-sample',
  41. ) ) .
  42. "<span class='title-part-{$complete_state}'>$complete_title</span>
  43. </span>
  44. ";
  45. }
  46. }
  47. }
  48. $sub_header_class = array( 'layout-' . VamtamTemplates::get_layout() );
  49. $page_header_bg = VamtamTemplates::page_header_background();
  50. // $has_header_bg should be true for non-transparent backgrounds
  51. $sub_header_bg_str = str_replace(
  52. 'background-color:transparent;background-image:none;',
  53. '',
  54. $page_header_bg . rd_vamtam_get_option( 'page-title-background', 'background-image' ) . rd_vamtam_get_option( 'page-title-background', 'background-color'
  55. ) );
  56. if ( ! empty( $sub_header_bg_str ) ) {
  57. $sub_header_class[] = 'has-background';
  58. }
  59. if ( ! VamtamTemplates::has_page_header() || is_404() ) return;
  60. if ( is_page_template( 'page-blank.php' ) ) return;
  61. $has_text_shadow = is_singular( VamtamFramework::$complex_layout ) && vamtam_sanitize_bool( get_post_meta( get_the_ID(), 'has-page-title-shadow', true ) );
  62. if ( $has_text_shadow ) {
  63. $sub_header_class[] = 'has-text-shadow';
  64. }
  65. ?>
  66. <div id="sub-header" class="<?php echo esc_attr( implode( ' ', $sub_header_class ) ) ?>">
  67. <div class="meta-header" style="<?php echo esc_attr( $page_header_bg ) ?>">
  68. <?php if ( $has_text_shadow ) : ?>
  69. <div class="text-shadow"> </div>
  70. <?php endif ?>
  71. <div class="limit-wrapper vamtam-box-outer-padding">
  72. <div class="meta-header-inside">
  73. <?php
  74. VamtamTemplates::page_header( false, $page_title );
  75. ?>
  76. </div>
  77. </div>
  78. </div>
  79. </div>