This repository has been archived by the owner on Feb 7, 2021. It is now read-only.
/
front-template-jumbotron.php
68 lines (59 loc) · 3.58 KB
/
front-template-jumbotron.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* Twenty'em WordPress Framework.
*
* WARNING: This file is part of Twenty'em WordPress Framework.
* DO NOT edit this file under any circumstances. Do all your modifications in the form of a child theme.
*
* @package WordPress
* @subpackage Twenty'em
* @author RogerTM
* @license license.txt
* @link https://themingisprose.com/twenty-em
* @since Twenty'em 1.2
*/
/**
* Display Jumbotron template for Front Page text widgets
*/
foreach ( t_em_front_page_widgets_options() as $widget ) :
if ( ! empty( t_em( 'headline_'.$widget['name'] ) ) || ! empty( t_em( 'content_'.$widget['name'] ) ) ) :
$widget_icon_class = ( t_em( 'headline_icon_class_'.$widget['name'] ) ) ?
'<span class="'. t_em( 'headline_icon_class_'.$widget['name'] ) .'"></span> ' : '';
$widget_thumbnail_url = ( t_em( 'thumbnail_src_'.$widget['name'] ) ) ?
'<div class="jumbo-widget-thumbnail mb-3"><img src="'. t_em( 'thumbnail_src_'.$widget['name'] ) .'" alt="'. sanitize_text_field( t_em( 'headline_'.$widget['name'] ) ).'" /></div>' : null;
$widget_headline = ( t_em( 'headline_'.$widget['name'] ) ) ?
'<h2 class="jumbo-widget-heading">'. $widget_icon_class . t_em( 'headline_'.$widget['name'] ) .'</h2>' : '';
$widget_content = ( t_em( 'content_'.$widget['name'] ) ) ?
'<div class="jumbo-widget-body">'. t_em_wrap_paragraph( do_shortcode( t_em( 'content_'.$widget['name'] ) ) ) .'</div>' : '';
$primary_link_text = ( t_em( 'primary_button_text_'.$widget['name'] ) ) ? t_em( 'primary_button_text_'.$widget['name'] ) : null;
$primary_link_icon_class = ( t_em( 'primary_button_icon_class_'.$widget['name'] ) ) ? t_em( 'primary_button_icon_class_'.$widget['name'] ) : null;
$primary_button_link = ( t_em( 'primary_button_link_'.$widget['name'] ) ) ? t_em( 'primary_button_link_'.$widget['name'] ) : null;
$secondary_link_text = ( t_em( 'secondary_button_text_'.$widget['name'] ) ) ? t_em( 'secondary_button_text_'.$widget['name'] ) : null;
$secondary_link_icon_class = ( t_em( 'secondary_button_icon_class_'.$widget['name'] ) ) ? t_em( 'secondary_button_icon_class_'.$widget['name'] ) : null;
$secondary_button_link = ( t_em( 'secondary_button_link_'.$widget['name'] ) ) ? t_em( 'secondary_button_link_'.$widget['name'] ) : null;
if ( ( $primary_button_link && $primary_link_text ) || ( $secondary_button_link && $secondary_link_text ) ) :
$primary_button_link_url = ( $primary_button_link && $primary_link_text ) ?
'<a href="'. $primary_button_link .'" class="btn btn-primary">
<span class="'.$primary_link_icon_class.'"></span> <span class="button-text">'. $primary_link_text .'</span></a>' : null;
$secondary_button_link_url = ( $secondary_button_link && $secondary_link_text ) ?
'<a href="'. $secondary_button_link .'" class="btn btn-secondary">
<span class="'.$secondary_link_icon_class.'"></span> <span class="button-text">'. $secondary_link_text .'</span></a>' : null;
$widget_footer = '<div class="jumbo-widget-footer">'. $primary_button_link_url . ' ' . $secondary_button_link_url .'</div>';
else :
$widget_footer = null;
endif;
$section = ( $widget['name'] == 'text_widget_one' ) ? 'primary-featured-widget-area' : 'secondary-featured-widget-area';
$jumbo = ( $widget['name'] == 'text_widget_one' ) ? 'jumbotron' : null;
?>
<div <?php t_em_breakpoint( $section ); ?>>
<div id="front-page-widget-<?php echo str_replace( 'text_widget_', '', $widget['name'] ) ?>" class="jumbo-widget mb-5 <?php echo $jumbo ?>">
<?php echo $widget_thumbnail_url; ?>
<?php echo $widget_headline;
echo $widget_content;
echo $widget_footer; ?>
</div>
</div>
<?php
endif;
endforeach;
?>