| 1 |
<?php |
| 2 |
/** |
| 3 |
* Services section for the homepage. |
| 4 |
*/ |
| 5 |
if ( ! function_exists( 'spiceb_spicepress_service' ) ) : |
| 6 |
|
| 7 |
function spiceb_spicepress_service() { |
| 8 |
|
| 9 |
$home_service_section_enabled = get_theme_mod('home_service_section_enabled','on'); |
| 10 |
$home_service_section_title = get_theme_mod('home_service_section_title',__('What we Offer?','spicepress')); |
| 11 |
$home_service_section_discription = get_theme_mod('home_service_section_discription','Sea summo mazim ex, ea errem eleifend definitionem vim. Ut nec hinc dolor possim mei ludus efficiendi ei sea summo mazim ex.'); |
| 12 |
$spicepress_service_content = get_theme_mod( 'spicepress_service_content', spiceb_spicepress_get_service_default() ); |
| 13 |
$section_is_empty = empty( $spicepress_service_content ) && empty( $home_service_section_discription ) && empty( $home_service_section_title ); |
| 14 |
if($home_service_section_enabled !='off') |
| 15 |
{ |
| 16 |
?> |
| 17 |
<!-- Section Title --> |
| 18 |
<section class="service-section"> |
| 19 |
<div class="container"> |
| 20 |
<?php if( ($home_service_section_title) || ($home_service_section_discription)!='' ) { ?> |
| 21 |
<div class="row"> |
| 22 |
<div class="col-md-12"> |
| 23 |
<div class="section-header"> |
| 24 |
<?php if ( ! empty( $home_service_section_title ) || is_customize_preview() ) : ?> |
| 25 |
<h1 class="widget-title"> |
| 26 |
<?php echo $home_service_section_title; ?> |
| 27 |
</h1> |
| 28 |
<?php endif; ?> |
| 29 |
<div class="widget-separator"><span></span></div> |
| 30 |
<?php if($home_service_section_discription) {?> |
| 31 |
<div class="separator"><span></span></div> |
| 32 |
<p class="wow fadeInDown animated"> |
| 33 |
<?php echo $home_service_section_discription; ?> |
| 34 |
</p> |
| 35 |
<?php } ?> |
| 36 |
</div> |
| 37 |
</div> |
| 38 |
</div> |
| 39 |
<!-- /Section Title --> |
| 40 |
<?php } |
| 41 |
spiceb_spicepress_service_content( $spicepress_service_content ); |
| 42 |
?> |
| 43 |
</div> |
| 44 |
</section> |
| 45 |
<?php } } |
| 46 |
|
| 47 |
endif; |
| 48 |
|
| 49 |
|
| 50 |
function spiceb_spicepress_service_content( $spicepress_service_content, $is_callback = false ) { |
| 51 |
if ( ! $is_callback ) { |
| 52 |
?> |
| 53 |
|
| 54 |
<?php |
| 55 |
} |
| 56 |
if ( ! empty( $spicepress_service_content ) ) : |
| 57 |
|
| 58 |
$allowed_html = array( |
| 59 |
'br' => array(), |
| 60 |
'em' => array(), |
| 61 |
'strong' => array(), |
| 62 |
'b' => array(), |
| 63 |
'i' => array(), |
| 64 |
); |
| 65 |
|
| 66 |
$spicepress_service_content = json_decode( $spicepress_service_content ); |
| 67 |
if ( ! empty( $spicepress_service_content ) ) { |
| 68 |
$i = 1; |
| 69 |
echo '<div class="row" id="service_content_section">'; |
| 70 |
foreach ( $spicepress_service_content as $service_item ) : |
| 71 |
$icon = ! empty( $service_item->icon_value ) ? $service_item->icon_value : ''; |
| 72 |
$image = ! empty( $service_item->image_url ) ? $service_item->image_url: ''; |
| 73 |
$title = ! empty( $service_item->title ) ? $service_item->title : ''; |
| 74 |
$text = ! empty( $service_item->text ) ? $service_item->text : ''; |
| 75 |
$link = ! empty( $service_item->link ) ? $service_item->link : ''; |
| 76 |
$color = ! empty( $service_item->color ) ? $service_item->color : ''; |
| 77 |
$choice = ! empty( $service_item->choice ) ? $service_item->choice : 'customizer_repeater_icon'; |
| 78 |
$open_new_tab = ! empty( $service_item->open_new_tab ) ? $service_item->open_new_tab : 'no'; |
| 79 |
|
| 80 |
?> |
| 81 |
<div class="col-md-4 col-sm-6 col-xs-12"> |
| 82 |
<div class="post text-center wow flipInX animated" data-wow-delay=".5s"> |
| 83 |
|
| 84 |
<figure class="post-thumbnail"> |
| 85 |
<?php if ( ! empty( $image ) ) : ?> |
| 86 |
|
| 87 |
<?php if ( ! empty( $link ) ) : ?> |
| 88 |
<a href="<?php echo esc_url( $link ); ?>" <?php if($open_new_tab == 'yes'){ echo 'target="_blank"';}?>> |
| 89 |
<?php endif; ?> |
| 90 |
<img class="services_cols_mn_icon" |
| 91 |
src="<?php echo esc_url( $image ); ?>" <?php if ( ! empty( $title ) ) : ?> alt="<?php echo esc_attr( $title ); ?>" title="<?php echo esc_attr( $title ); ?>" <?php endif; ?> /> |
| 92 |
<?php if ( ! empty( $link ) ) : ?> |
| 93 |
</a> |
| 94 |
<?php endif; ?> |
| 95 |
<?php endif; ?> |
| 96 |
|
| 97 |
<?php if ( ! empty( $link ) ) : ?> |
| 98 |
<a href="<?php echo esc_url( $link ); ?>" <?php if($open_new_tab == 'yes'){ echo 'target="_blank"';}?> > |
| 99 |
<?php endif; ?> |
| 100 |
<?php if ( ! empty( $icon ) ) :?> |
| 101 |
|
| 102 |
<i class="fa <?php echo esc_html( $icon ); ?> txt-pink"></i> |
| 103 |
|
| 104 |
<?php endif; ?> |
| 105 |
</figure> |
| 106 |
<?php if ( ! empty( $title ) ) : ?> |
| 107 |
|
| 108 |
<div class="entry-header"> |
| 109 |
<h4 class="entry-title"><?php echo esc_html( $title ); ?></h4> |
| 110 |
</div> |
| 111 |
<?php endif; ?> |
| 112 |
<?php if ( ! empty( $link ) ) : ?> |
| 113 |
</a> |
| 114 |
<?php endif; ?> |
| 115 |
<?php if ( ! empty( $text ) ) : ?> |
| 116 |
|
| 117 |
<div class="entry-content"> |
| 118 |
<p><?php echo wp_kses( html_entity_decode( $text ), $allowed_html ); ?></p> |
| 119 |
</div> |
| 120 |
|
| 121 |
|
| 122 |
<?php endif; ?> |
| 123 |
</div> |
| 124 |
</div> |
| 125 |
<?php |
| 126 |
if ( $i % apply_filters( 'spicepress_service_per_row_no', 3 ) == 0 ) { |
| 127 |
echo '</div><!-- /.row -->'; |
| 128 |
echo '<div class="row">'; |
| 129 |
} |
| 130 |
$i++; |
| 131 |
|
| 132 |
endforeach; |
| 133 |
echo '</div>'; |
| 134 |
}// End if(). |
| 135 |
endif; |
| 136 |
if ( ! $is_callback ) { |
| 137 |
?> |
| 138 |
|
| 139 |
<?php |
| 140 |
} |
| 141 |
} |
| 142 |
|
| 143 |
/** |
| 144 |
* Get default values for service section. |
| 145 |
* |
| 146 |
* @since 1.1.31 |
| 147 |
* @access public |
| 148 |
*/ |
| 149 |
function spiceb_spicepress_get_service_default() { |
| 150 |
|
| 151 |
return apply_filters( |
| 152 |
'spicepress_service_content', json_encode( |
| 153 |
array( |
| 154 |
array( |
| 155 |
'icon_value' => 'fa-laptop', |
| 156 |
'title' => esc_html__( 'Easy to Use', 'spicepress' ), |
| 157 |
'text' => 'Phasellus facilisis, nunc in lacinia auctor, eros lacus aliquet velit, quis lobortis risus nunc nec nisi maecans et turpis vitae velit.volutpat porttitor a sit amet est. In eu rutrum ante. Nullam id lorem fermentum, accumsan enim non auctor neque.', 'spicepress', |
| 158 |
'link' => '#', |
| 159 |
'open_new_tab' => 'no', |
| 160 |
), |
| 161 |
array( |
| 162 |
'icon_value' => 'fa fa-cogs', |
| 163 |
'title' => esc_html__( 'Multi-Purpose', 'spicepress' ), |
| 164 |
'text' => 'Phasellus facilisis, nunc in lacinia auctor, eros lacus aliquet velit, quis lobortis risus nunc nec nisi maecans et turpis vitae velit.volutpat porttitor a sit amet est. In eu rutrum ante. Nullam id lorem fermentum, accumsan enim non auctor neque.', 'spicepress', |
| 165 |
'link' => '#', |
| 166 |
'open_new_tab' => 'no', |
| 167 |
), |
| 168 |
array( |
| 169 |
'icon_value' => 'fa fa-mobile', |
| 170 |
'title' => esc_html__( 'Responsive Design', 'spicepress' ), |
| 171 |
'text' => 'Phasellus facilisis, nunc in lacinia auctor, eros lacus aliquet velit, quis lobortis risus nunc nec nisi maecans et turpis vitae velit.volutpat porttitor a sit amet est. In eu rutrum ante. Nullam id lorem fermentum, accumsan enim non auctor neque.', |
| 172 |
'link' => '#', |
| 173 |
'open_new_tab' => 'no', |
| 174 |
), |
| 175 |
) |
| 176 |
) |
| 177 |
); |
| 178 |
} |
| 179 |
|
| 180 |
if ( function_exists( 'spiceb_spicepress_service' ) ) { |
| 181 |
$section_priority = apply_filters( 'spicepress_section_priority', 11, 'spiceb_spicepress_service' ); |
| 182 |
add_action( 'spiceb_spicepress_sections', 'spiceb_spicepress_service', absint( $section_priority ) ); |
| 183 |
} |