Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $date = get_the_date("Y-m-d");
- $d = explode("-", $date);
- $cats = get_the_category();
- $version = "";
- foreach($cats as $kat) {
- //print_r($kat);
- if ($kat->slug=="damals-aktuelles-heft") {
- $version = "damals-aktuelles-heft";
- $search = "titelbeitrag";
- }
- if ($kat->slug=="weitere-themen") {
- $version = "weitere-themen";
- $search = "damals-aktuelles-heft";
- }
- }
- $args = array(
- 'id' => false,
- 'post_type' => 'post',
- 'order' => 'DESC',
- 'orderby' => 'date',
- 'post_status' => 'publish',
- 'category_name' => $search,
- 'date_query' => array(
- 'year' => intval($d[0]),
- 'month' => intval($d[1]),
- 'day' => intval($d[2])
- )
- );
- switch ($version) {
- case 'damals-aktuelles-heft':
- $args["posts_per_page"] = -1;
- global $posts;
- $original_posts = $posts;
- $titelids = array();
- $posts = new WP_Query( $args );
- ob_start();
- echo "<h3>Beiträge in dieser Ausgabe</h3>";
- if ( $posts->have_posts() ) {
- while ( $posts->have_posts() ) :
- $posts->the_post();
- global $post;
- $more_link = '<a class="herald-science-read-more" href="' . esc_url( get_permalink() ) .'" title="' . esc_attr( get_the_title() ) . '">' . __herald('read_more') . '</a>';
- $titelids[] = get_the_id();
- ?>
- <div class="row">
- <?php
- $cw = 12;
- if ( has_post_thumbnail() ) : ?>
- <div class="col-lg-4 col-md-4 col-sm-4">
- <div class="herald-post-thumbnail herald-format-icon-middle">
- <a href="<?php echo esc_url( get_permalink() ); ?>" title="<?php echo esc_attr( get_the_title() ); ?>">
- <?php
- $fimg = herald_get_featured_image( 'herald-lay-b1' );
- echo $fimg; ?>
- <?php echo herald_post_format_icon(); ?>
- </a>
- </div>
- </div>
- <?php
- $cw=8;
- endif; ?>
- <div class="col-lg-<?php echo $cw; ?> col-md-<?php echo $cw; ?> col-sm-<?php echo $cw; ?>">
- <div class="entry-header">
- <span class="meta-category"><?php echo herald_get_category(); ?></span>
- <?php the_title( sprintf( '<h2 class="entry-title h2"><a href="%s">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
- </div>
- <div class="entry-content"><?php echo herald_get_excerpt( 'a' , $more_link); ?></div>
- </div>
- </div>
- <?php
- endwhile;
- }
- ?>
- <hr/>
- <?php
- $args["category_name"] = "weitere-themen";
- $posts = new WP_Query( $args );
- if ( $posts->have_posts() ) {
- while ( $posts->have_posts() ) :
- $posts->the_post();
- global $post;
- if (!in_array(get_the_id(), $titelids)) {
- $more_link = '<a class="herald-science-read-more" href="' . esc_url( get_permalink() ) .'" title="' . esc_attr( get_the_title() ) . '">' . __herald('read_more') . '</a>';
- ?>
- <div class="row">
- <?php
- $cw = 12;
- if ( has_post_thumbnail() ) : ?>
- <div class="col-lg-4 col-md-4 col-sm-4">
- <div class="herald-post-thumbnail herald-format-icon-middle">
- <a href="<?php echo esc_url( get_permalink() ); ?>" title="<?php echo esc_attr( get_the_title() ); ?>">
- <?php
- $fimg = herald_get_featured_image( 'herald-lay-b1' );
- echo $fimg; ?>
- <?php echo herald_post_format_icon(); ?>
- </a>
- </div>
- </div>
- <?php
- $cw=8;
- endif; ?>
- <div class="col-lg-<?php echo $cw; ?> col-md-<?php echo $cw; ?> col-sm-<?php echo $cw; ?>">
- <div class="entry-header">
- <span class="meta-category"><?php echo herald_get_category(); ?></span>
- <?php the_title( sprintf( '<h2 class="entry-title h2"><a href="%s">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
- </div>
- <div class="entry-content"><?php echo herald_get_excerpt( 'a' , $more_link); ?></div>
- </div>
- </div>
- <?php
- }
- endwhile;
- }
- $output = ob_get_contents();
- ob_end_clean();
- $posts = $original_posts;
- wp_reset_postdata();
- wp_reset_query();
- break;
- case 'weitere-themen':
- $args["posts_per_page"] = 1;
- global $posts;
- $original_posts = $posts;
- $posts = new WP_Query( $args );
- ob_start();
- if ( $posts->have_posts() ) {
- while ( $posts->have_posts() ) :
- $posts->the_post();
- global $post;
- ?>
- <?php the_title( sprintf( '<p class=""><a href="%s">Zur Übersicht: ', esc_url( get_permalink() ) ), '</a></p>' ); ?>
- <?php
- endwhile;
- }
- break;
- default:
- echo "";
- break;
- }
- ?>
- <?php
- echo $output;
- ?>
Add Comment
Please, Sign In to add comment