You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

107 line
3.4 KiB

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