| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * Front Page |
|---|
| 4 | * |
|---|
| 5 | * @package square |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | $square_page = ''; |
|---|
| 9 | $square_page_array = get_pages(); |
|---|
| 10 | if(is_array($square_page_array)){ |
|---|
| 11 | $square_page = $square_page_array[0]->ID; |
|---|
| 12 | } |
|---|
| 13 | |
|---|
| 14 | if ( 'page' == get_option( 'show_on_front' ) ) { |
|---|
| 15 | include( get_page_template() ); |
|---|
| 16 | }else{ |
|---|
| 17 | get_header(); |
|---|
| 18 | ?> |
|---|
| 19 | <section id="sq-home-slider-section"> |
|---|
| 20 | <div id="sq-bx-slider"> |
|---|
| 21 | <?php for ($i=1; $i < 4; $i++) { |
|---|
| 22 | if($i == 1){ |
|---|
| 23 | $square_slider_title = get_theme_mod('square_slider_title1', __('Free WordPress Themes', 'square')); |
|---|
| 24 | $square_slider_subtitle = get_theme_mod('square_slider_subtitle1', __('Create website in no time', 'square')); |
|---|
| 25 | $square_slider_image = get_theme_mod('square_slider_image1', get_template_directory_uri().'/images/bg.jpg'); |
|---|
| 26 | }else{ |
|---|
| 27 | $square_slider_title = get_theme_mod('square_slider_title'.$i); |
|---|
| 28 | $square_slider_subtitle = get_theme_mod('square_slider_subtitle'.$i); |
|---|
| 29 | $square_slider_image = get_theme_mod('square_slider_image'.$i); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | if( $square_slider_image ){ |
|---|
| 33 | ?> |
|---|
| 34 | <div class="sq-slide sq-slide-count<?php echo $i; // WPCS: XSS OK. ?>"> |
|---|
| 35 | <img src="<?php echo esc_url( $square_slider_image ); ?>" alt="<?php esc_attr_e('Slider', 'square') ?>"> |
|---|
| 36 | |
|---|
| 37 | <?php if( $square_slider_title || $square_slider_subtitle){ ?> |
|---|
| 38 | <div class="sq-container"> |
|---|
| 39 | <div class="sq-slide-caption"> |
|---|
| 40 | <div class="sq-slide-cap-title animated fadeInDown"> |
|---|
| 41 | <?php echo esc_html( $square_slider_title ); ?> |
|---|
| 42 | </div> |
|---|
| 43 | |
|---|
| 44 | <div class="sq-slide-cap-desc animated fadeInUp"> |
|---|
| 45 | <?php echo esc_html( $square_slider_subtitle ); ?> |
|---|
| 46 | </div> |
|---|
| 47 | </div> |
|---|
| 48 | </div> |
|---|
| 49 | <?php } ?> |
|---|
| 50 | </div> |
|---|
| 51 | <?php |
|---|
| 52 | } |
|---|
| 53 | } ?> |
|---|
| 54 | </div> |
|---|
| 55 | <div class="sq-banner-shadow"><img src="<?php echo get_template_directory_uri() // WPCS: XSS OK. ?>/images/banner-shadow.png" alt="<?php esc_attr_e('Banner Shadow', 'square'); ?>"></div> |
|---|
| 56 | </section> |
|---|
| 57 | |
|---|
| 58 | <section id="sq-featured-post-section" class="sq-section"> |
|---|
| 59 | <div class="sq-container"> |
|---|
| 60 | <div class="sq-featured-post-wrap sq-clearfix"> |
|---|
| 61 | <?php |
|---|
| 62 | $square_enable_featured_link = get_theme_mod('square_enable_featured_link', true); |
|---|
| 63 | for( $i = 1; $i < 4; $i++ ){ |
|---|
| 64 | $square_featured_page_id = get_theme_mod('square_featured_page'.$i, $square_page ); |
|---|
| 65 | $square_featured_page_icon = get_theme_mod('square_featured_page_icon'.$i, 'fa-bell'); |
|---|
| 66 | |
|---|
| 67 | if($square_featured_page_id){ |
|---|
| 68 | $args = array( 'page_id' => $square_featured_page_id ); |
|---|
| 69 | $query = new WP_Query($args); |
|---|
| 70 | if($query->have_posts()): |
|---|
| 71 | while($query->have_posts()) : $query->the_post(); |
|---|
| 72 | ?> |
|---|
| 73 | <div class="sq-featured-post <?php echo 'sq-featured-post'.$i // WPCS: XSS OK.; ?>"> |
|---|
| 74 | <div class="sq-featured-icon"><i class="fa <?php echo esc_attr( $square_featured_page_icon ); ?>"></i></div> |
|---|
| 75 | <h4><?php the_title(); ?></h4> |
|---|
| 76 | <div class="sq-featured-excerpt"> |
|---|
| 77 | <?php |
|---|
| 78 | if( has_excerpt() && '' != trim(get_the_excerpt())){ |
|---|
| 79 | echo get_the_excerpt(); // WPCS: XSS OK. |
|---|
| 80 | }else{ |
|---|
| 81 | echo square_excerpt( get_the_content(), 120); // WPCS: XSS OK. |
|---|
| 82 | }?> |
|---|
| 83 | </div> |
|---|
| 84 | <?php |
|---|
| 85 | if($square_enable_featured_link){ |
|---|
| 86 | ?> |
|---|
| 87 | <a href="<?php the_permalink(); ?>" class="sq-featured-readmore"><i class="fa fa-plus-square-o"></i></a> |
|---|
| 88 | <?php |
|---|
| 89 | } |
|---|
| 90 | ?> |
|---|
| 91 | </div> |
|---|
| 92 | <?php |
|---|
| 93 | endwhile; |
|---|
| 94 | endif; |
|---|
| 95 | wp_reset_postdata(); |
|---|
| 96 | } |
|---|
| 97 | } |
|---|
| 98 | ?> |
|---|
| 99 | </div> |
|---|
| 100 | </div> |
|---|
| 101 | </section> |
|---|
| 102 | |
|---|
| 103 | <?php |
|---|
| 104 | $square_disable_about_sec = get_theme_mod('square_disable_about_sec'); |
|---|
| 105 | if(!$square_disable_about_sec){ |
|---|
| 106 | $square_about_image_stack = get_theme_mod('square_about_image_stack'); |
|---|
| 107 | $square_about_sec_class = !$square_about_image_stack ? 'sq-about-fullwidth' : ""; |
|---|
| 108 | ?> |
|---|
| 109 | <section id="sq-about-us-section" class="sq-section"> |
|---|
| 110 | <div class="sq-container sq-clearfix"> |
|---|
| 111 | <div class="sq-about-sec <?php echo esc_attr($square_about_sec_class); ?>"> |
|---|
| 112 | <?php |
|---|
| 113 | $args = array( |
|---|
| 114 | 'page_id' => get_theme_mod('square_about_page') |
|---|
| 115 | ); |
|---|
| 116 | $query = new WP_Query($args); |
|---|
| 117 | if($query->have_posts() && get_theme_mod('square_about_page')): |
|---|
| 118 | while($query->have_posts()) : $query->the_post(); |
|---|
| 119 | ?> |
|---|
| 120 | <h2 class="sq-section-title"><?php the_title(); ?></h2> |
|---|
| 121 | <div class="sq-content"><?php the_content(); ?></div> |
|---|
| 122 | <?php |
|---|
| 123 | endwhile; |
|---|
| 124 | endif; |
|---|
| 125 | wp_reset_postdata(); |
|---|
| 126 | ?> |
|---|
| 127 | </div> |
|---|
| 128 | |
|---|
| 129 | <?php |
|---|
| 130 | if($square_about_image_stack){ |
|---|
| 131 | ?> |
|---|
| 132 | <div class="sq-image-stack"> |
|---|
| 133 | <ul id="sq-elasticstack" class="sq-elasticstack"> |
|---|
| 134 | <?php |
|---|
| 135 | $square_about_image_stack = explode(',', $square_about_image_stack); |
|---|
| 136 | |
|---|
| 137 | foreach ($square_about_image_stack as $square_about_image_stack_single) { |
|---|
| 138 | $image = wp_get_attachment_image_src( $square_about_image_stack_single, 'square-about-thumb'); |
|---|
| 139 | $image_alt = get_post_meta( $square_about_image_stack_single, '_wp_attachment_image_alt', true); |
|---|
| 140 | $image_alt_text = $image_alt ? $image_alt : __('About Us Gallery', 'square'); |
|---|
| 141 | ?> |
|---|
| 142 | <li><img src="<?php echo esc_url( $image[0] ); ?>" alt="<?php echo esc_html($image_alt_text) ?>"></li> |
|---|
| 143 | <?php |
|---|
| 144 | } |
|---|
| 145 | ?> |
|---|
| 146 | </ul> |
|---|
| 147 | </div> |
|---|
| 148 | <?php } ?> |
|---|
| 149 | </div> |
|---|
| 150 | </section> |
|---|
| 151 | <?php } |
|---|
| 152 | |
|---|
| 153 | $square_disable_tab_sec = get_theme_mod('square_disable_tab_sec'); |
|---|
| 154 | if(!$square_disable_tab_sec){ |
|---|
| 155 | ?> |
|---|
| 156 | <section id="sq-tab-section" class="sq-section"> |
|---|
| 157 | <div class="sq-container sq-clearfix"> |
|---|
| 158 | <ul class="sq-tab"> |
|---|
| 159 | <?php |
|---|
| 160 | for( $i = 1; $i < 6; $i++ ){ |
|---|
| 161 | $square_tab_title = get_theme_mod('square_tab_title'.$i); |
|---|
| 162 | $square_tab_icon = get_theme_mod('square_tab_icon'.$i, 'fa-bell'); |
|---|
| 163 | |
|---|
| 164 | if($square_tab_title){ |
|---|
| 165 | ?> |
|---|
| 166 | <li class="sq-tab-list<?php echo $i; // WPCS: XSS OK. ?>"> |
|---|
| 167 | <a href="#<?php echo 'sq-tab'.$i; // WPCS: XSS OK.?>"> |
|---|
| 168 | <?php echo '<i class="fa '.esc_attr( $square_tab_icon ).'"></i><span>'.esc_html( $square_tab_title ) .'</span>'; ?> |
|---|
| 169 | </a> |
|---|
| 170 | </li> |
|---|
| 171 | <?php |
|---|
| 172 | } |
|---|
| 173 | } |
|---|
| 174 | ?> |
|---|
| 175 | </ul> |
|---|
| 176 | |
|---|
| 177 | <div class="sq-tab-content"> |
|---|
| 178 | <?php |
|---|
| 179 | for ($i = 1; $i < 6 ; $i++) { |
|---|
| 180 | $square_tab_page = get_theme_mod('square_tab_page'.$i); |
|---|
| 181 | if($square_tab_page){ |
|---|
| 182 | ?> |
|---|
| 183 | <div class="sq-tab-pane animated zoomIn" id="<?php echo 'sq-tab'.$i; // WPCS: XSS OK. ?>"> |
|---|
| 184 | <?php |
|---|
| 185 | $args = array( |
|---|
| 186 | 'page_id' => $square_tab_page |
|---|
| 187 | ); |
|---|
| 188 | $query = new WP_Query($args); |
|---|
| 189 | if($query->have_posts()): |
|---|
| 190 | while($query->have_posts()) : $query->the_post(); |
|---|
| 191 | ?> |
|---|
| 192 | <h2 class="sq-section-title"><?php the_title(); ?></h2> |
|---|
| 193 | <div class="sq-content"><?php the_content(); ?></div> |
|---|
| 194 | <?php |
|---|
| 195 | endwhile; |
|---|
| 196 | endif; |
|---|
| 197 | wp_reset_postdata(); |
|---|
| 198 | ?> |
|---|
| 199 | </div> |
|---|
| 200 | <?php |
|---|
| 201 | } |
|---|
| 202 | } |
|---|
| 203 | ?> |
|---|
| 204 | </div> |
|---|
| 205 | </div> |
|---|
| 206 | </section> |
|---|
| 207 | <?php } |
|---|
| 208 | |
|---|
| 209 | $square_disable_logo_sec = get_theme_mod('square_disable_logo_sec'); |
|---|
| 210 | if(!$square_disable_logo_sec){ |
|---|
| 211 | ?> |
|---|
| 212 | <section id="sq-logo-section" class="sq-section"> |
|---|
| 213 | <div class="sq-container"> |
|---|
| 214 | <?php |
|---|
| 215 | $square_logo_title = get_theme_mod('square_logo_title'); |
|---|
| 216 | ?> |
|---|
| 217 | |
|---|
| 218 | <?php if($square_logo_title){ ?> |
|---|
| 219 | <h2 class="sq-section-title"><?php echo esc_html( $square_logo_title ); ?></h2> |
|---|
| 220 | <?php } ?> |
|---|
| 221 | |
|---|
| 222 | <?php |
|---|
| 223 | $square_client_logo_image = get_theme_mod('square_client_logo_image'); |
|---|
| 224 | $square_client_logo_image = explode(',', $square_client_logo_image); |
|---|
| 225 | ?> |
|---|
| 226 | |
|---|
| 227 | <div class="sq_client_logo_slider"> |
|---|
| 228 | <?php |
|---|
| 229 | foreach ($square_client_logo_image as $square_client_logo_image_single) { |
|---|
| 230 | $image = wp_get_attachment_image_src( $square_client_logo_image_single, 'full'); |
|---|
| 231 | $image_alt = get_post_meta( $square_client_logo_image_single, '_wp_attachment_image_alt', true); |
|---|
| 232 | $image_alt_text = $image_alt ? $image_alt : __('Logo', 'square'); |
|---|
| 233 | ?> |
|---|
| 234 | <img src="<?php echo esc_url( $image[0] ); ?>" alt="<?php echo esc_html($image_alt_text) ?>"> |
|---|
| 235 | <?php |
|---|
| 236 | } |
|---|
| 237 | ?> |
|---|
| 238 | </div> |
|---|
| 239 | </div> |
|---|
| 240 | </section> |
|---|
| 241 | <?php } ?> |
|---|
| 242 | <?php |
|---|
| 243 | get_footer(); |
|---|
| 244 | } |
|---|