block.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /*
  3. * Name: Header
  4. * Section: header
  5. * Description: Default header with company info
  6. */
  7. $default_options = array(
  8. 'font_family' => $font_family,
  9. 'font_size' => 14,
  10. 'font_color' => '#444444',
  11. 'font_weight' => 'normal',
  12. 'block_background' => '#ffffff',
  13. 'block_padding_top'=>15,
  14. 'block_padding_bottom'=>15,
  15. 'block_padding_left'=>15,
  16. 'block_padding_right'=>15
  17. );
  18. $options = array_merge($default_options, $options);
  19. if (empty($info['header_logo']['id'])) {
  20. $image = false;
  21. } else {
  22. $image = tnp_media_resize($info['header_logo']['id'], array(200, 80));
  23. if (is_wp_error($image)) {
  24. $image = false;
  25. }
  26. }
  27. $empty = empty($info['header_logo']['id']) && empty($info['header_sub']) && empty($info['header_title']);
  28. ?>
  29. <?php if ($empty) { ?>
  30. <p>Please, set your company info.</p>
  31. <?php } else { ?>
  32. <style>
  33. .header-text {
  34. padding: 10px;
  35. text-align: right;
  36. font-size: <?php echo $options['font_size'] ?>px;
  37. font-family: <?php echo $options['font_family'] ?>;
  38. font-weight: <?php echo $options['font_weight'] ?>;
  39. color: <?php echo $options['font_color'] ?>;
  40. }
  41. .header-logo {
  42. font-family: <?php echo $options['font_family'] ?>;
  43. font-size: <?php echo $options['font_size']*1.1 ?>px;
  44. line-height: normal;
  45. font-weight: <?php echo $options['font_weight'] ?>;
  46. color: <?php echo $options['font_color'] ?>;
  47. }
  48. </style>
  49. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  50. <tr>
  51. <?php if ( $image ) { ?>
  52. <td align="left" width="50%" inline-class="header-logo">
  53. <a href="#" target="_blank">
  54. <img alt="<?php echo esc_attr( $info['header_title'] ) ?>" src="<?php echo $image ?>"
  55. style="display: block; max-width: 100%" border="0">
  56. </a>
  57. <?php } else { ?>
  58. <td align="left" width="50%" inline-class="heading-text"
  59. style="padding: 5px; font-size: 24px; font-family: Helvetica, Arial, sans-serif; font-weight: bold; color: #444444;">
  60. <?php echo esc_attr( $info['header_title'] ) ?>
  61. <?php } ?>
  62. </td>
  63. <td width="50%" align="right" class="mobile-hide" inline-class="header-text">
  64. <?php echo $info['header_sub'] ?>
  65. </td>
  66. </tr>
  67. </table>
  68. <?php } ?>