| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/clients/client2/web20/web/wp-content/themes/drogentest-online/ |
Upload File : |
<?php
/**
* Einzelner Blog-Beitrag (single.php).
*
* @package drogentest-online
*/
get_header();
while ( have_posts() ) :
the_post();
$cats = get_the_category();
?>
<header class="dgt-pagehead">
<?php dgt_breadcrumb(); ?>
</header>
<section class="dgt-content">
<article <?php post_class( 'dgt-single' ); ?>>
<div class="dgt-single-header">
<?php dgt_post_meta(); ?>
<h1 class="dgt-single-title"><?php the_title(); ?></h1>
</div>
<?php
if ( has_post_thumbnail() ) :
$dgt_thumb_caption = wp_get_attachment_caption( get_post_thumbnail_id() );
?>
<figure class="dgt-single-thumb">
<?php the_post_thumbnail( 'large', array( 'alt' => esc_attr( get_the_title() ) ) ); ?>
<?php if ( $dgt_thumb_caption ) : ?>
<figcaption class="dgt-thumb-cap"><?php echo wp_kses_post( $dgt_thumb_caption ); ?></figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
<div class="dgt-single-content">
<?php
the_content();
wp_link_pages(
array(
'before' => '<div class="dgt-pagination"><span>Seiten:</span> ',
'after' => '</div>',
)
);
?>
</div>
<footer class="dgt-single-footer">
<?php if ( has_tag() ) : ?>
<div class="dgt-tags">
<?php
foreach ( get_the_tags() as $tag ) {
printf( '<a class="dgt-tag" href="%s">#%s</a>', esc_url( get_tag_link( $tag->term_id ) ), esc_html( $tag->name ) );
}
?>
</div>
<?php endif; ?>
<a class="dgt-readmore" href="<?php echo esc_url( get_post_type_archive_link( 'post' ) ? get_post_type_archive_link( 'post' ) : home_url( '/' ) ); ?>">
<svg width="16" height="12" viewBox="0 0 18 14" aria-hidden="true" style="transform:scaleX(-1)"><path d="M1 7h15m0 0-5.5-5.5M16 7l-5.5 5.5" stroke="currentColor" stroke-width="1.8" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>
Zurück zum Blog
</a>
</footer>
</article>
<?php
// Verwandte Beiträge: zuerst aus der eigenen Kategorie, dann mit aktuellen
// Beiträgen aus anderen Kategorien auffüllen, falls nicht genug zusammenkommen.
$dgt_rel_want = 3;
$dgt_rel_exclude = array( get_the_ID() );
$dgt_rel_ids = array();
if ( ! empty( $cats ) ) {
$dgt_rel_ids = get_posts(
array(
'category__in' => wp_list_pluck( $cats, 'term_id' ),
'post__not_in' => $dgt_rel_exclude,
'numberposts' => $dgt_rel_want,
'ignore_sticky_posts' => true,
'fields' => 'ids',
)
);
}
// Auffüllen aus anderen Kategorien (neueste Beiträge).
if ( count( $dgt_rel_ids ) < $dgt_rel_want ) {
$dgt_rel_fill = get_posts(
array(
'post__not_in' => array_merge( $dgt_rel_exclude, $dgt_rel_ids ),
'numberposts' => $dgt_rel_want - count( $dgt_rel_ids ),
'orderby' => 'date',
'order' => 'DESC',
'ignore_sticky_posts' => true,
'fields' => 'ids',
)
);
$dgt_rel_ids = array_merge( $dgt_rel_ids, $dgt_rel_fill );
}
if ( ! empty( $dgt_rel_ids ) ) :
$related = new WP_Query(
array(
'post__in' => $dgt_rel_ids,
'orderby' => 'post__in',
'posts_per_page' => $dgt_rel_want,
'ignore_sticky_posts' => true,
'no_found_rows' => true,
)
);
if ( $related->have_posts() ) :
?>
<div class="dgt-single dgt-related">
<h2 class="dgt-related-title">Das könnte Sie auch interessieren</h2>
<div class="row g-4">
<?php
while ( $related->have_posts() ) :
$related->the_post();
?>
<div class="col-sm-6 col-md-4">
<article <?php post_class( 'dgt-post-card' ); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<a class="dgt-card-media" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
<?php the_post_thumbnail( 'dgt-card', array( 'alt' => esc_attr( get_the_title() ) ) ); ?>
</a>
<?php else : ?>
<span class="dgt-card-media dgt-card-media--empty">Drogentest Online</span>
<?php endif; ?>
<div class="dgt-card-body">
<?php dgt_post_meta(); ?>
<h3 class="dgt-card-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<a class="dgt-readmore" href="<?php the_permalink(); ?>">
<?php echo esc_html( get_the_title() ); ?> lesen
<svg width="16" height="12" viewBox="0 0 18 14" aria-hidden="true"><path d="M1 7h15m0 0-5.5-5.5M16 7l-5.5 5.5" stroke="currentColor" stroke-width="1.8" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>
</a>
</div>
</article>
</div>
<?php
endwhile;
?>
</div>
</div>
<?php
wp_reset_postdata();
endif;
endif;
?>
</section>
<?php
endwhile;
get_footer();