Guest User

Untitled

a guest
May 5th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. <?php
  2. /**
  3. * Header Logo Inner
  4. *
  5. * This file displays the image logo or standard text logo
  6. *
  7. * @package Total WordPress Theme
  8. * @subpackage Partials
  9. * @version 4.8
  10. */
  11.  
  12. // Exit if accessed directly
  13. if ( ! defined( 'ABSPATH' ) ) {
  14. exit;
  15. }
  16.  
  17. // Define variables
  18. $logo_url = wpex_header_logo_url();
  19. $logo_img = wpex_header_logo_img();
  20. $logo_icon = wpex_header_logo_icon();
  21. $logo_title = wpex_header_logo_title();
  22.  
  23. // Overlay Header logo (make sure overlay header is enabled first)
  24. $overlay_logo = wpex_has_overlay_header() ? wpex_overlay_header_logo_img() : '';
  25.  
  26. // Define output
  27. $output = '';
  28.  
  29. // Display image logo
  30. if ( $logo_img || $overlay_logo ) {
  31.  
  32. // Logo img attributes
  33. $img_attrs = apply_filters( 'wpex_header_logo_img_attrs', array(
  34. 'src' => esc_url( $logo_img ),
  35. 'alt' => esc_attr( $logo_title ),
  36. 'class' => 'logo-img',
  37. 'data-no-retina' => 'data-no-retina',
  38. 'width' => intval( wpex_header_logo_img_width() ),
  39. 'height' => intval( wpex_header_logo_img_height() ),
  40. ) );
  41.  
  42. // Custom site-wide image logo
  43. if ( $logo_img && ! $overlay_logo ) {
  44.  
  45. $output .= '<a href="' . esc_url( $logo_url ) . '" rel="home" class="main-logo">';
  46.  
  47. $output .= '<img ' . wpex_parse_attrs( $img_attrs ) . ' />';
  48.  
  49. $output .= '</a>';
  50.  
  51. }
  52.  
  53. // Custom header-overlay logo => Must be added on it's own HTML. IMPORTANT!
  54. if ( $overlay_logo ) {
  55.  
  56. $img_attrs['src'] = esc_url( $overlay_logo );
  57.  
  58. $output .= '<a href="' . esc_url( $logo_url ) . '" rel="home" class="overlay-header-logo">';
  59.  
  60. $output .= '<img ' . wpex_parse_attrs( $img_attrs ) . ' />';
  61.  
  62. $output .= '</a>';
  63.  
  64. }
  65.  
  66. }
  67.  
  68. // Display text logo
  69. else {
  70.  
  71. $output .= '<a href="' . esc_url( $logo_url ) . '" rel="home" class="site-logo-text">';
  72.  
  73. $output .= $logo_icon . esc_html( $logo_title );
  74.  
  75. $output .= '</a>';
  76.  
  77. }
  78.  
  79. // Echo logo output
  80. echo apply_filters( 'wpex_header_logo_output', $output );
Advertisement
Add Comment
Please, Sign In to add comment