custom-modern-theme/single-projekte.php

95 lines
4.5 KiB
PHP
Raw Normal View History

2024-07-31 20:14:58 +02:00
<?php
/**
* Template Name: Einzelprojekt
*
* This template is used to display single custom post type "projekte".
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content-container">
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header>
<!-- hier werden die einzelnen Elemente geladen -->
<div class="entry-content">
<?php
$projekt_name = get_post_meta( get_the_ID(), '_projekt_name', true );
$projekt_website = get_post_meta( get_the_ID(), '_projekt_website', true );
$projekt_description = get_post_meta( get_the_ID(), '_projekt_description', true );
$projekt_since = get_post_meta( get_the_ID(), '_projekt_since', true );
$projekt_links = get_post_meta( get_the_ID(), '_projekt_links', true );
?>
<!-- jetzt kommt der code der diese anzeigt mit entsprechenden Styling css Elementen -->
<!-- <p><strong><?php _e( 'Name:' ); ?></strong> <?php echo esc_html( $projekt_name ); ?></p>
-->
<?php if ( !empty( $projekt_since ) ) : ?>
<p><em><?php _e( 'Dabei seit:' ); ?> <?php echo esc_html( $projekt_since ); ?></em></p>
<?php endif; ?>
<!-- wenn ein featured image gesetzt wurde, dann wird two-column layout verwendet (links Bild rechts Text) -->
<?php if ( has_post_thumbnail() ) : ?>
<div class="wp-block-columns is-layout-flex wp-container-3">
<div class="wp-block-column is-layout-flow" style="flex-basis:33.33%">
<?php $featured_image_url = get_the_post_thumbnail_url(); ?>
<figure class="wp-block-image size-full is-resized">
<img decoding="async" src="<?php echo $featured_image_url; ?>" alt="" class="wp-image-2987">
</figure>
</div>
<div class="wp-block-column is-layout-flow" style="flex-basis:66.66%">
<!-- Kurzbeschreibung -->
<?php _e( '' ); ?></strong> <?php echo esc_html( $projekt_description ); ?>
<!-- unter die Kurzbeschreibung die restliche Beschreibung -->
<p></p> <!-- leerzeile -->
<?php _e( '' ); ?></strong> <?php echo esc_html( $projekt_links ); ?>
<!-- Darunter ein Button, auf dem die Webseite des Projekts verlinkt ist. -->
<p>
</p>
<div class="wp-block-buttons is-content-justification-center is-layout-flex wp-container-1 wp-block-buttons-is-layout-flex">
<p>
<div class="wp-block-button"><a class="wp-block-button__link has-text-color has-background has-text-align-center wp-element-button" href="https://newyorck.net/projektubersicht/" style="color:var(--color_accent_text);background-color:var(--color_accent);"><?php _e( 'Alle Projekte' ); ?></a></div>
</p>
<p>
<div class="wp-block-button"><a class="wp-block-button__link has-text-color has-background has-text-align-center wp-element-button" href="<?php echo esc_url( $projekt_website ); ?>" style="color:var(--color_accent_text);background-color:var(--color_accent);"><?php _e( 'Webseite' ); ?></a></div>
</p>
</div>
</div>
</div>
<!-- wenn kein featured image gesetzt wurde, dann wird one column text full width verwendet -->
<?php else : ?>
<div class="wp-block-column is-layout-flow" style="flex-basis:100%">
<!-- Kurzbeschreibung -->
<?php _e( '' ); ?></strong> <?php echo esc_html( $projekt_description ); ?>
<!-- unter die Kurzbeschreibung die restliche Beschreibung -->
<p></p> <!-- leerzeile -->
<?php _e( '' ); ?></strong> <?php echo esc_html( $projekt_links ); ?>
<!-- Darunter ein Button, auf dem die Webseite des Projekts verlinkt ist. -->
<p>
<div class="wp-block-button"><a class="wp-block-button__link has-text-color has-background has-text-align-center wp-element-button" href="<?php echo esc_url( $projekt_website ); ?>" style="color:var(--color_accent_text);background-color:var(--color_accent);"><?php _e( 'zur Webseite' ); ?></a></div>
</p>
</div>
<?php endif; ?>
<?php endwhile; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_footer(); ?>
<style>
@media (max-width: 767px) {
.entry-content-container {
padding: 20px;
margin: 20px;
}
}
</style>