calc.php
2.67 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
50
51
52
<?php
function fenix_calc ($atts, $content)
{
$atts = shortcode_atts(
array(
'id' => '',
'title' => ''
),
$atts,
'fenix_calc'
);
$out = '';
$out = ''.
'<!--Примеры эффективных-->'.
'<div id="'.$atts['id'].'" class="container fenix_calc">'.
'<div class="row">'.
'<div class="col-12 col-md-7">'.
'<h1>'.$atts['title'].'</h1>'.
'<div class="mb-3">'.
'<label for="calc_inv_'.$atts['id'].'" class="form-label mb-3">Первоначальные инвестиции, руб</label>'.
'<input type="number" class="form-control rounded-pill p-2 px-4" id="calc_inv_'.$atts['id'].'" name="calc_inv" required="required" value="0" min="0" max="10000000" />'.
'</div>'.
'<div class="mb-3">'.
'<label for="calc_s_'.$atts['id'].'" class="form-label mb-3">Площадь помещения, м<sup>2</sup></label>'.
'<input type="number" class="form-control rounded-pill p-2 px-4" id="calc_s_'.$atts['id'].'" name="calc_s" required="required" value="20" min="10" max="10000" />'.
'</div>'.
'<div class="mb-3">'.
'<label for="calc_rashod_'.$atts['id'].'" class="form-label mb-3">Расходы, руб</label>'.
'<input type="number" class="form-control rounded-pill p-2 px-4" id="calc_rashod_'.$atts['id'].'" name="calc_rashod" required="required" value="0" min="0" max="10000000" />'.
'</div>'.
'</div>'.
'<div class="col-12 col-md-5">'.
'<div class="calc_result_title text-color-3 h1">Примерный доход, руб:</div>'.
'<div class="calc_result_value text-center h3">0</div>'.
(
has_post_thumbnail($post->ID)?
'<img src="'.get_the_post_thumbnail_url($post->ID, 'full').'" class="img-fluid mb-4 mb-md-0"/>':
''
).
'</div>'.
'</div>'.
'<div class="row">'.
'<div class="col-12">'.
'<button name="calc" type="button" class="btn btn-lg btn-style-0 rounded-pill calc_btn" role="button" id="calc_btn_'.$atts['id'].'">Рассчитать</button>'.
'</div>'.
'</div>'.
'</div>';
return $out;
}
add_shortcode('fenix_calc', 'fenix_calc');