-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle-recipe.php
More file actions
160 lines (147 loc) · 9.87 KB
/
Copy pathsingle-recipe.php
File metadata and controls
160 lines (147 loc) · 9.87 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* Portfolio Single Template
*
* @package Tomato
* @author ThemeSuared
* @link http://themesuared.com/tomato/
*/
//Translation Theme Options
$spyropress_translate['recipe-direction'] = get_setting( 'translate' ) ? get_setting( 'recipe-direction', 'Direction' ) : esc_html__( 'Direction', 'tomato' );
$spyropress_translate['recipe-ingredients'] = get_setting( 'translate' ) ? get_setting( 'recipe-ingredients', 'Ingredients' ) : esc_html__( 'Ingredients', 'tomato' );
$spyropress_translate['recipe-descriptions'] = get_setting( 'translate' ) ? get_setting( 'recipe-descriptions', 'Descriptions' ) : esc_html__( 'Descriptions', 'tomato' );
$spyropress_translate['recipe-nutrition'] = get_setting( 'translate' ) ? get_setting( 'recipe-nutrition', 'Nutrition' ) : esc_html__( 'Nutrition', 'tomato' );
$spyropress_translate['recipe-nutrient'] = get_setting( 'translate' ) ? get_setting( 'recipe-nutrient', 'Nutrient' ) : esc_html__( 'Nutrient', 'tomato' );
$spyropress_translate['recipe-dv'] = get_setting( 'translate' ) ? get_setting( 'recipe-dv', 'DV' ) : esc_html__( 'DV', 'tomato' );
$spyropress_translate['recipe-dv-percentage'] = get_setting( 'translate' ) ? get_setting( 'recipe-dv-percentage', '%DV' ) : esc_html__( '%DV', 'tomato' );
get_header();
spyropress_before_main_container();
get_template_part( 'templates/page', 'breadcrumb' ); //Include Page Breadcrumb Html.
?>
<section class="recipie-single single-recipe">
<div class="container">
<div class="row">
<?php
spyropress_before_loop();
if( have_posts() ) {
while( have_posts() ) {
the_post();
spyropress_before_post();
//Meta data Information.
$spyropress_data = get_post_meta( get_the_ID(), '_recipe_details', true );
?>
<div class="col-md-6">
<?php
//Check And Print Gallery.
if( isset($spyropress_data['gallery']) && !empty ($spyropress_data['gallery']) && $spyropress_data['display'] == 'gallery' ) {
$spyropress_ids = explode( ',', str_replace( array( '[gallery ids=', ']', '"' ), '', $spyropress_data['gallery'] ) );
if ( !empty( $spyropress_ids ) ) {
$spyropress_gallery_item = $spyropress_gallery_nav = '';
foreach( $spyropress_ids as $spyropress_id ) {
$spyropress_gallery_item .= get_image( array(
'attachment' => $spyropress_id,
'width' => 9999,
'responsive' => true,
'echo' => false,
'class' => 'img-responsive',
'before' => '<div>',
'after' => '</div>'
));
$spyropress_gallery_nav .= get_image( array(
'attachment' => $spyropress_id,
'width' => 9999,
'responsive' => true,
'echo' => false,
'class' => 'img-responsive',
'before' => '<div>',
'after' => '</div>'
));
}
echo '<div class="single-recipe-carousel">'. $spyropress_gallery_item .'</div><div class="single-recipe-carousel-nav">'. $spyropress_gallery_nav .'</div>';
}
}elseif( isset($spyropress_data['video']) && !empty ($spyropress_data['video']) && $spyropress_data['display'] == 'video' ) {
echo '<div class="single-recipe-image"><div class="video">'. wp_oembed_get( $spyropress_data['video'],array( 'height' => '300' ) ). '</div></div>';
}elseif( has_post_thumbnail() ) {
get_image( array( 'before'=> '<div class="single-recipe-image">', 'after' => '</div>', 'class' => 'img-responsive' ) );
}
?>
<div class="clearfix"></div>
<h3><?php echo esc_html( $spyropress_translate['recipe-direction'] ); ?></h3>
<br>
<?php
if( isset( $spyropress_data['directions'] ) ){
echo '<ol class="directions-list">';
foreach( $spyropress_data['directions'] as $spyropress_direction ){
echo '<li>'. esc_html( $spyropress_direction['direction_item'] ) .'</li>';
}
echo '</ol>';
}
?>
</div>
<div class="col-md-6">
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<div class="ingredients">
<h4 class="title"><?php echo esc_html( $spyropress_translate['recipe-ingredients'] ); ?></h4>
<?php
if( isset( $spyropress_data['ingredients'] ) ){
echo '<ul>';
foreach( $spyropress_data['ingredients'] as $spyropress_ingredient ){
if (isset($spyropress_ingredient['ingredients_item'])) {
echo '<li><i class="fa fa-check-square-o"></i>'. esc_html( $spyropress_ingredient['ingredients_item'] ) .'</li>';
}
}
echo '</ul>';
}
?>
</div>
<h3 class="heading-bottom-line"><?php echo esc_html( $spyropress_translate['recipe-descriptions'] ); ?></h3>
<?php if( isset( $spyropress_data['descriptions'] ) ){ echo wp_kses( $spyropress_data['descriptions'], array( 'p' => array() ) ); }?>
<div class="nutrition-table">
<h3 class="heading-bottom-line"><?php echo esc_html( $spyropress_translate['recipe-nutrition'] ); ?></h3>
<?php if( isset( $spyropress_data['nutritions'] ) ): ?>
<div class="table-responsive">
<table>
<tbody>
<tr>
<th><?php echo esc_html( $spyropress_translate['recipe-nutrient'] ); ?></th>
<th><?php echo esc_html( $spyropress_translate['recipe-dv'] ); ?></th>
<th><?php echo esc_html( $spyropress_translate['recipe-dv-percentage'] ); ?></th>
</tr>
<?php
//Table Contents.
foreach( $spyropress_data['nutritions'] as $spyropress_nutrition ){
echo '<tr>';
if( isset( $spyropress_nutrition['nutrient'] ) ){
echo '<td>'. esc_html( $spyropress_nutrition['nutrient'] ) .'</td>';
}
if( isset( $spyropress_nutrition['dv'] ) ){
echo '<td>'. esc_html( $spyropress_nutrition['dv'] ) .'</td>';
}
if( isset( $spyropress_nutrition['dv_percentage'] ) ){
echo '<td>'. esc_html( $spyropress_nutrition['dv_percentage'] ) .'%<span class="progressbar"><span class="level-'. esc_attr( $spyropress_nutrition['dv_percentage'] ) .'"></span></span></td>';
}
echo '</tr>';
}
?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
<?php
spyropress_after_post();
}
}else{
echo '<h3>'.esc_html__( 'Sorry No Post Where Found', 'tomato' ).'</h3>';
}
spyropress_after_post();
?>
</div>
</div>
</section>
<?php
get_template_part( 'templates/related', 'recipe' ); //include related recipe.
spyropress_after_main_container();
get_footer();