forked from NB-Public/jkb-childtheme
added fundraising template
This commit is contained in:
parent
1c65ef9483
commit
0d607fe7fd
10 changed files with 244 additions and 33 deletions
49
functions/childtheme-shortcodes.php
Normal file
49
functions/childtheme-shortcodes.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
//Query Posts ***************
|
||||
|
||||
function grlp_tag_list($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'aussehen' => '',
|
||||
'schlagwort' => '',
|
||||
), $atts));
|
||||
global $wp_query,$paged,$post;
|
||||
$temp = $wp_query;
|
||||
$wp_query= null;
|
||||
$wp_query = new WP_Query();
|
||||
$message = "";
|
||||
|
||||
if(!empty($schlagwort)){
|
||||
$args = array(
|
||||
'tag' => $schlagwort,
|
||||
'category_name' => 'allgemein',
|
||||
'posts_per_page' => 10,
|
||||
'paged' => 1,
|
||||
);
|
||||
|
||||
}
|
||||
else {
|
||||
$message = "Konnte kein Schlagwort finden. Bitte mit dem Attribut 'tag=\"<schlagwort>\"' im shortcode eintragen.";
|
||||
}
|
||||
|
||||
$wp_query->query($args);
|
||||
ob_start(); ?>
|
||||
|
||||
<?php if (!empty($message)):?>
|
||||
<p style="color:#f44;"><?= $message ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<section class="clearfix insidelist <?php echo $aussehen;?>">
|
||||
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
|
||||
|
||||
<?php get_template_part( 'content-list', get_post_format() ); ?>
|
||||
<?php endwhile; ?>
|
||||
</section>
|
||||
|
||||
<?php $wp_query = null; $wp_query = $temp;
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $content;
|
||||
}
|
||||
add_shortcode("schlagwort_liste", "grlp_tag_list");
|
||||
|
||||
?>
|
Reference in a new issue