| 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
/**
* Drogenpolitik – Einzelner Länderbeitrag.
*
* @package drogentest-online
*/
get_header();
$dgt_dp_flag_dir = get_theme_file_uri( 'assets/img/flags' );
while ( have_posts() ) :
the_post();
$slug = get_post_field( 'post_name', get_the_ID() );
$parent = wp_get_post_parent_id( get_the_ID() );
$country_slug = $parent ? get_post_field( 'post_name', $parent ) : $slug;
$own_flag = get_theme_file_path( 'assets/img/flags/' . $slug . '.svg' );
if ( file_exists( $own_flag ) ) {
$flag_slug = $slug;
$flag_title = get_the_title();
} else {
$flag_slug = $country_slug;
$flag_title = $parent ? get_the_title( $parent ) : get_the_title();
}
$flag_file = get_theme_file_path( 'assets/img/flags/' . $flag_slug . '.svg' );
$flag_url = $dgt_dp_flag_dir . '/' . $flag_slug . '.svg';
$flag_img = file_exists( $flag_file )
? sprintf( '<img src="%s" alt="Flagge %s" class="dgt-dp-flag" width="64" height="43" loading="eager">', esc_url( $flag_url ), esc_attr( $flag_title ) )
: '<span class="dgt-dp-hero-flag">🌍</span>';
?>
<header class="dgt-pagehead">
<?php
$bc = array(
array( 'label' => 'Aufklärung', 'url' => home_url( '/einfach-aufgeklaert/' ) ),
array( 'label' => 'Drogenpolitik', 'url' => home_url( '/einfach-aufgeklaert/drogenpolitik/' ) ),
);
if ( $parent ) {
$bc[] = array( 'label' => get_the_title( $parent ), 'url' => get_permalink( $parent ) );
}
dgt_breadcrumb( '', $bc );
?>
</header>
<section class="dgt-content">
<article class="dgt-single">
<div class="dgt-dp-hero">
<a class="dgt-dp-hero-flag" href="<?php echo esc_url( get_permalink() ); ?>"><?php echo $flag_img; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></a>
<div class="dgt-dp-hero-body">
<h1 class="dgt-dp-hero-title"><?php the_title(); ?></h1>
<p class="dgt-dp-hero-sub">Drogenpolitik & Gesetzeslage <?php echo $parent ? '' : '– Länderprofil'; ?></p>
<p class="dgt-dp-hero-author">Von <strong>Drogentest-online.de</strong></p>
</div>
</div>
<div class="dgt-dp-content dgt-single-content">
<?php the_content(); ?>
</div>
<?php
$children = get_posts( array(
'post_type' => 'drogenpolitik',
'post_parent' => get_the_ID(),
'post_status' => 'publish',
'numberposts' => 60,
'orderby' => 'title',
'order' => 'ASC',
) );
if ( $children ) :
?>
<h2 class="dgt-section-title">Weitere Artikel zu <?php the_title(); ?></h2>
<div class="dgt-dp-children">
<?php foreach ( $children as $child ) :
$ch_slug = $child->post_name;
$ch_flag = get_theme_file_path( 'assets/img/flags/' . $ch_slug . '.svg' );
$ch_flag_url = $dgt_dp_flag_dir . '/' . $ch_slug . '.svg';
if ( ! file_exists( $ch_flag ) ) {
$ch_flag = $flag_file;
$ch_flag_url = $flag_url;
}
?>
<a class="dgt-dp-child-card" href="<?php echo esc_url( get_permalink( $child->ID ) ); ?>">
<?php if ( file_exists( $ch_flag ) ) : ?>
<img src="<?php echo esc_url( $ch_flag_url ); ?>" alt="Flagge <?php echo esc_attr( $child->post_title ); ?>" class="dgt-dp-flag-sm" width="24" height="16" loading="lazy">
<?php endif; ?>
<?php echo esc_html( $child->post_title ); ?>
<svg width="16" height="12" viewBox="0 0 18 14" aria-hidden="true" style="margin-left:auto;"><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>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if ( $parent ) :
$siblings = get_posts( array(
'post_type' => 'drogenpolitik',
'post_parent' => $parent,
'post_status' => 'publish',
'numberposts' => 60,
'orderby' => 'title',
'order' => 'ASC',
'exclude' => array( get_the_ID() ),
) );
if ( $siblings ) :
?>
<h2 class="dgt-section-title">Weitere Artikel zu <?php echo esc_html( get_the_title( $parent ) ); ?></h2>
<div class="dgt-dp-children">
<?php foreach ( $siblings as $dp_sib ) :
$sib_slug = $dp_sib->post_name;
$sib_flag = get_theme_file_path( 'assets/img/flags/' . $sib_slug . '.svg' );
$sib_flag_url = $dgt_dp_flag_dir . '/' . $sib_slug . '.svg';
if ( ! file_exists( $sib_flag ) ) {
$sib_flag = $flag_file;
$sib_flag_url = $flag_url;
}
?>
<a class="dgt-dp-child-card" href="<?php echo esc_url( get_permalink( $dp_sib->ID ) ); ?>">
<?php if ( file_exists( $sib_flag ) ) : ?>
<img src="<?php echo esc_url( $sib_flag_url ); ?>" alt="Flagge <?php echo esc_attr( $dp_sib->post_title ); ?>" class="dgt-dp-flag-sm" width="24" height="16" loading="lazy">
<?php endif; ?>
<?php echo esc_html( $dp_sib->post_title ); ?>
<svg width="16" height="12" viewBox="0 0 18 14" aria-hidden="true" style="margin-left:auto;"><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>
<?php endforeach; ?>
</div>
<?php endif; endif; ?>
<?php
$dgt_show_blog = false;
$dgt_cs = $parent ? $country_slug : $slug;
$dgt_cats = dgt_dp_categories();
foreach ( array( 'cannabis-social-clubs', 'entkriminalisierung', 'cannabis-legal', 'medizinisches-cannabis' ) as $dgt_ck ) {
if ( isset( $dgt_cats[ $dgt_ck ] ) && in_array( $dgt_cs, $dgt_cats[ $dgt_ck ]['countries'], true ) ) {
$dgt_show_blog = true;
break;
}
}
if ( ! $dgt_show_blog && 'europa' === dgt_dp_continent_for_country( $dgt_cs ) ) {
$dgt_show_blog = true;
}
if ( $dgt_show_blog ) {
dgt_blog_teaser( 1300 );
}
?>
<aside class="dgt-dp-test-teaser">
<div class="dgt-dp-test-teaser-inner">
<div class="dgt-dp-test-teaser-icon">
<svg width="42" height="42" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M9 2v5.17l-1.59-1.58L6 7l4 4 4-4-1.41-1.41L11 7.17V2H9z" fill="#108e6c" opacity=".5"/><path d="M5 13h14v2H5v-2zm0 4h14v2H5v-2zm2-12h10v2H7V5z" fill="#108e6c"/><rect x="3" y="11" width="18" height="10" rx="2" stroke="#108e6c" stroke-width="1.5" fill="none"/></svg>
</div>
<div class="dgt-dp-test-teaser-body">
<p class="dgt-dp-test-teaser-over">Drogentest kaufen</p>
<p class="dgt-dp-test-teaser-title">Vor der Reise nach <?php echo esc_html( $flag_title ); ?> auf Nummer sicher gehen?</p>
<?php
$dgt_cont_slug = dgt_dp_continent_for_country( $country_slug );
$dgt_cont_data = $dgt_cont_slug ? dgt_dp_continents()[ $dgt_cont_slug ] : null;
?>
<p class="dgt-dp-test-teaser-text">Gerade in <?php echo $dgt_cont_data ? esc_html( $dgt_cont_data['name'] ) : 'vielen Ländern'; ?> variieren die Drogengesetze stark. Mit einem Schnelltest prüfen, ob noch Substanzen nachweisbar sind – diskret, anonym und in wenigen Minuten.</p>
<div class="dgt-dp-test-teaser-actions">
<a class="dgt-dp-test-teaser-btn" href="<?php echo esc_url( home_url( '/drogentest/' ) ); ?>">
Drogentests ansehen
<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>
<a class="dgt-dp-test-teaser-link" href="<?php echo esc_url( home_url( '/blog/2026/nachweiszeiten-drogen-thc-kokain-amphetamin/' ) ); ?>">Nachweiszeiten prüfen</a>
</div>
</div>
</div>
</aside>
<div class="dgt-dp-nav">
<?php if ( $parent ) : ?>
<a class="dgt-readmore" href="<?php echo esc_url( get_permalink( $parent ) ); ?>" style="transform:scaleX(1);">
<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 zu <?php echo esc_html( get_the_title( $parent ) ); ?>
</a>
<?php else : ?>
<a class="dgt-readmore" href="<?php echo esc_url( home_url( '/einfach-aufgeklaert/drogenpolitik/' ) ); ?>">
<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>
Alle Länder im Überblick
</a>
<?php endif; ?>
</div>
</article>
</section>
<?php if ( ! $parent ) :
$dgt_cur_cont_slug = dgt_dp_continent_for_country( $country_slug );
$dgt_all_conts = dgt_dp_continents();
$dgt_cur_cont = $dgt_cur_cont_slug ? $dgt_all_conts[ $dgt_cur_cont_slug ] : null;
if ( $dgt_cur_cont ) :
$dgt_cont_posts = dgt_dp_country_posts( $dgt_cur_cont['countries'] );
$dgt_cont_posts = array_filter( $dgt_cont_posts, function( $p ) { return $p->ID !== get_the_ID(); } );
?>
<section class="dgt-content">
<h2 class="dgt-section-title">Weitere Länder in <?php echo esc_html( $dgt_cur_cont['name'] ); ?></h2>
<div class="dgt-dp-cont-xlinks">
<?php foreach ( $dgt_all_conts as $xc_slug => $xc ) :
if ( $xc_slug === $dgt_cur_cont_slug ) continue;
?>
<a class="dgt-dp-cont-xlink" href="<?php echo esc_url( dgt_dp_continent_url( $xc_slug ) ); ?>" title="Drogenpolitik in <?php echo esc_attr( $xc['name'] ); ?>">
<?php echo esc_html( $xc['name'] ); ?>
<span class="dgt-dp-cont-xlink-count"><?php echo count( $xc['countries'] ); ?></span>
</a>
<?php endforeach; ?>
</div>
<div class="dgt-dp-search" data-dgt-dp-search>
<div class="dgt-dp-search-field">
<svg class="dgt-dp-search-ico" width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><circle cx="11" cy="11" r="7" stroke="#8b97a6" stroke-width="1.8"/><path d="m20 20-3.5-3.5" stroke="#8b97a6" stroke-width="1.8" stroke-linecap="round"/></svg>
<input type="search" class="dgt-dp-search-input" placeholder="Land in <?php echo esc_attr( $dgt_cur_cont['name'] ); ?> suchen …" aria-label="Länderprofile filtern" autocomplete="off">
</div>
<p class="dgt-dp-search-count" aria-live="polite"></p>
</div>
<div class="dgt-dp-others" data-dgt-dp-list>
<?php foreach ( $dgt_cont_posts as $dp_other ) :
$dp_o_slug = $dp_other->post_name;
$dp_o_flag = get_theme_file_path( 'assets/img/flags/' . $dp_o_slug . '.svg' );
?>
<a class="dgt-dp-other" href="<?php echo esc_url( get_permalink( $dp_other->ID ) ); ?>" title="Drogenpolitik in <?php echo esc_attr( $dp_other->post_title ); ?>" data-dgt-dp-name="<?php echo esc_attr( $dp_other->post_title ); ?>">
<?php if ( file_exists( $dp_o_flag ) ) : ?>
<img class="dgt-dp-other-flag" src="<?php echo esc_url( $dgt_dp_flag_dir . '/' . $dp_o_slug . '.svg' ); ?>" alt="Flagge <?php echo esc_attr( $dp_other->post_title ); ?>" width="28" height="19" loading="lazy">
<?php endif; ?>
<span class="dgt-dp-other-name"><?php echo esc_html( $dp_other->post_title ); ?></span>
<svg class="dgt-dp-other-arrow" width="14" height="10" 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>
<?php endforeach; ?>
</div>
</section>
<?php
endif;
endif;
?>
<?php
endwhile;
get_footer();