-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathausfluege.php
54 lines (43 loc) · 1.01 KB
/
ausfluege.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* template for rendering ausfluege
*
* @package gemeindetag-ausfluege
*/
namespace gemeindetag\ausfluege;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
/**
* render ausfluege
*
* @param Array $attributes attributes
* @param String $content InnerBlocks
*/
function gemeindetag_ausfluege_render_callback( $attributes, $content ) {
ob_start();
?>
<div class="wp-block-ausfluegecpt-ausfluege">
<?php
$args = [
'post_type' => 'ausfluege',
'posts_per_page' => 99,
'order' => 'ASC',
'meta_key' => 'character',
'meta_value' => $attributes['character'],
'meta_compare' => '=',
];
$ausfluege_query = new \WP_Query( $args );
if ( $ausfluege_query->have_posts() ) : while ( $ausfluege_query->have_posts() ) : $ausfluege_query->the_post();
?>
<?php include _get_plugin_directory() . '/ausflug.php'; ?>
<?php endwhile; else : ?>
<p>Keine Ausflüge</p>
<?php
endif;
wp_reset_postdata();
?>
</div>
<?php
$data = ob_get_clean();
return $data;
}