|
- <?php
- /**
- * Template Name: Alternate
- *
- * Page template with left aligne headline and sidebars aligned to headline.
- *
- */
-
- get_header() ?>
-
- <?php the_post() ?>
-
- <?php
- $site_host = parse_url(get_site_url(), PHP_URL_HOST);
- $post_id = get_the_ID();
- $post_type = get_post_type($post_id);
- $post_meta = sandbox_get_post_meta($post_id);
-
- if ( !isset($post_meta['_hide']) || !filter_var($post_meta['_hide'], FILTER_VALIDATE_BOOLEAN) ) {
- $post_taxonomies = sandbox_get_the_taxonomies_and_terms($post_id);
-
- $content = '';
- $post_class = 'no-download';
- $content_meta_args = array('date');
-
- // post thumbnail as background image
- $post_style = '';
- if ( has_post_thumbnail() ) {
- $post_style = ' style="background-image:url(' . get_the_post_thumbnail_url($post_id, 'sandbox-hero') . ');"';
- }
-
- // Post type "page" fields
- $subheadline = isset($post_meta['_subheadline']) ? apply_filters('the_content', $post_meta['_subheadline']) : '';
-
- // Post type "page"
- if ( $post_type === 'page' ) {
- $content_meta_args = false;
- }
-
- // Post type "service"
- if ( $post_type === 'service' ) {
- $content_meta_args = false;
- }
-
- // Post type "product" fields
- $produkt_pdf = isset($post_meta['_pdf-download']) ? $post_meta['_pdf-download'] : '';
- $produkt_url = isset($post_meta['_product-url']) ? $post_meta['_product-url'] : '';
-
- if ( !empty($produkt_pdf) ) {
- $produkt_url = wp_get_attachment_url($produkt_pdf);
- }
- if ( $post_type === 'produkt' ) {
- $content_meta_args = false;
- }
-
- // Download button
- $download_url = !empty($produkt_pdf) ? $produkt_pdf : '';
- $download_target = '';
-
- if ( !empty($download_url) ) {
- if ( parse_url($download_url, PHP_URL_HOST) !== $site_host ) {
- $download_target = ' target="_blank" rel="noopener"';
- }
- $post_class = 'has-download';
- }
-
- if ( empty($content) ) {
- $content = apply_filters('the_content', get_the_content());
- }
- ?>
- <article id="content" <?php post_class($post_class) ?>>
- <?php
- /*
- * @Sidebar Content before
- */
- get_sidebar('content-before'); ?>
- <div class="content inner">
- <header class="content-header clearfix"<?php echo $post_style; ?>>
- <div class="inner">
- <h1 class="title"><?php the_title(); ?>
- <?php if ( !empty($download_url) ) { ?>
- <a class="download" href="<?php echo $download_url; ?>"<?php echo $download_target; ?>><?php echo __('Download', 'sandbox'); ?></a>
- <?php } ?></h1>
- <?php if ( !empty($subheadline) ) { ?>
- <div class="subheadline">
- <?php echo $subheadline; ?>
- </div>
- <?php } ?>
- <?php if ( has_excerpt() ) { ?>
- <div class="intro">
- <?php the_excerpt(); ?>
- </div>
- <?php } ?>
- <?php if ( $meta = sandbox_get_meta_data($content_meta_args) ) { ?>
- <ul class="meta">
- <?php echo $meta; ?>
- </ul>
- <?php } ?>
- </div>
- </header>
- <?php if ( !empty($content) ) { ?>
- <?php echo $content; ?>
- <?php } ?>
- </div>
- <?php
- /*
- * @Sidebar Content after
- */
- get_sidebar('content-after'); ?>
- <?php // If comments are open or we have at least one comment, load up the comment template. ?>
- <?php if ( comments_open() || get_comments_number() ) { ?>
- <?php comments_template('/comments.php'); ?>
- <?php } ?>
- </article><!-- .post -->
- <?php } ?>
-
- <?php get_footer() ?>
|