No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

118 líneas
3.6 KiB

  1. <?php
  2. /**
  3. * Template Name: Alternate
  4. *
  5. * Page template with left aligne headline and sidebars aligned to headline.
  6. *
  7. */
  8. get_header() ?>
  9. <?php the_post() ?>
  10. <?php
  11. $site_host = parse_url(get_site_url(), PHP_URL_HOST);
  12. $post_id = get_the_ID();
  13. $post_type = get_post_type($post_id);
  14. $post_meta = sandbox_get_post_meta($post_id);
  15. if ( !isset($post_meta['_hide']) || !filter_var($post_meta['_hide'], FILTER_VALIDATE_BOOLEAN) ) {
  16. $post_taxonomies = sandbox_get_the_taxonomies_and_terms($post_id);
  17. $content = '';
  18. $post_class = 'no-download';
  19. $content_meta_args = array('date');
  20. // post thumbnail as background image
  21. $post_style = '';
  22. if ( has_post_thumbnail() ) {
  23. $post_style = ' style="background-image:url(' . get_the_post_thumbnail_url($post_id, 'sandbox-hero') . ');"';
  24. }
  25. // Post type "page" fields
  26. $subheadline = isset($post_meta['_subheadline']) ? apply_filters('the_content', $post_meta['_subheadline']) : '';
  27. // Post type "page"
  28. if ( $post_type === 'page' ) {
  29. $content_meta_args = false;
  30. }
  31. // Post type "service"
  32. if ( $post_type === 'service' ) {
  33. $content_meta_args = false;
  34. }
  35. // Post type "product" fields
  36. $produkt_pdf = isset($post_meta['_pdf-download']) ? $post_meta['_pdf-download'] : '';
  37. $produkt_url = isset($post_meta['_product-url']) ? $post_meta['_product-url'] : '';
  38. if ( !empty($produkt_pdf) ) {
  39. $produkt_url = wp_get_attachment_url($produkt_pdf);
  40. }
  41. if ( $post_type === 'produkt' ) {
  42. $content_meta_args = false;
  43. }
  44. // Download button
  45. $download_url = !empty($produkt_pdf) ? $produkt_pdf : '';
  46. $download_target = '';
  47. if ( !empty($download_url) ) {
  48. if ( parse_url($download_url, PHP_URL_HOST) !== $site_host ) {
  49. $download_target = ' target="_blank" rel="noopener"';
  50. }
  51. $post_class = 'has-download';
  52. }
  53. if ( empty($content) ) {
  54. $content = apply_filters('the_content', get_the_content());
  55. }
  56. ?>
  57. <article id="content" <?php post_class($post_class) ?>>
  58. <?php
  59. /*
  60. * @Sidebar Content before
  61. */
  62. get_sidebar('content-before'); ?>
  63. <div class="content inner">
  64. <header class="content-header clearfix"<?php echo $post_style; ?>>
  65. <div class="inner">
  66. <h1 class="title"><?php the_title(); ?>
  67. <?php if ( !empty($download_url) ) { ?>
  68. <a class="download" href="<?php echo $download_url; ?>"<?php echo $download_target; ?>><?php echo __('Download', 'sandbox'); ?></a>
  69. <?php } ?></h1>
  70. <?php if ( !empty($subheadline) ) { ?>
  71. <div class="subheadline">
  72. <?php echo $subheadline; ?>
  73. </div>
  74. <?php } ?>
  75. <?php if ( has_excerpt() ) { ?>
  76. <div class="intro">
  77. <?php the_excerpt(); ?>
  78. </div>
  79. <?php } ?>
  80. <?php if ( $meta = sandbox_get_meta_data($content_meta_args) ) { ?>
  81. <ul class="meta">
  82. <?php echo $meta; ?>
  83. </ul>
  84. <?php } ?>
  85. </div>
  86. </header>
  87. <?php if ( !empty($content) ) { ?>
  88. <?php echo $content; ?>
  89. <?php } ?>
  90. </div>
  91. <?php
  92. /*
  93. * @Sidebar Content after
  94. */
  95. get_sidebar('content-after'); ?>
  96. <?php // If comments are open or we have at least one comment, load up the comment template. ?>
  97. <?php if ( comments_open() || get_comments_number() ) { ?>
  98. <?php comments_template('/comments.php'); ?>
  99. <?php } ?>
  100. </article><!-- .post -->
  101. <?php } ?>
  102. <?php get_footer() ?>