Ist schon ein doller Code für einen Shortcode ... 8-)
Du könntest im query mal mit dem post_status spielen, evtl. reicht es diesen auf publish zu setzen. Ich vermute allerdings, wie Monika es auch schreibt, dass eingeloggte User die 'private' Beiträge trotzdem sehen:
https://codex.wordpress.org/Class_Referenc…atus_Parameters
PHP
function derLoop($atts, $content = null) {
extract(shortcode_atts(array(
"pagination" => 'true',
"query" => '',
"category" => '',
), $atts));
global $wp_query,$paged,$post;
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
if($pagination == 'true'){ $query .= '&paged='.$paged; }
if(!empty($category)){ $query .= '&category_name='.$category; }
if(!empty($query)){ $query .= $query; }
$query .= '&post_status=publish';
$wp_query->query($query);
ob_start();
?>
<h2><?php echo $category; ?></h2>
<ul class="loop">
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<li><?php echo get_the_date( 'd.m.Y' ); ?><br><a href="<?php the_permalink() ?>" rel="bookmark"><?php echo $thumbnail_image; the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php if($pagination == 'true'){ ?>
<div class="navigation">
<div class="alignleft"><?php previous_posts_link('« zurück') ?></div>
<div class="alignright"><?php next_posts_link('weiter »') ?></div>
</div>
<?php } ?>
<?php $wp_query = null; $wp_query = $temp;
$content = ob_get_contents();
ob_end_clean();
return $content;
}
Alles anzeigen