medbus.php
1.78 KB
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
<?php
function fenix_medbus ($atts)
{
$atts = shortcode_atts(
array(
'post' => '',
'id' => ''
),
$atts,
'fenix_medbus'
);
$out = '';
if ($atts['post']!=='')
{
$args = array(
'numberposts' => 1,
'post__in' => array($atts['post']),
'order' => 'ASC',
'limit' => 1
);
$posts = get_posts($args);
foreach($posts as $key=>$post)
{
$out = ''.
'<!--Медицинский бизнес-->'.
'<div id="'.$atts['id'].'" class="container-fluid fenix_medbus shadow-sm">'.
'<div class="row flex-md-row-reverse">'.
(
has_post_thumbnail($post->ID)?
'<div class="col-12 col-md-6">'.
'<img src="'.get_the_post_thumbnail_url($post->ID, 'full').'" class="img-fluid mb-4 mb-md-0"/>'.
'</div>':
''
).
'<div class="col-12 col-md-6 text-end pt-md-4 mw-md">'.
$post->post_content.
'</div>'.
'</div>'.
'</div>';
}
wp_reset_postdata();
unset($key, $post, $posts, $args);
}
return $out;
}
add_shortcode('fenix_medbus', 'fenix_medbus');