Example #1
0
/**
 * $content_width global variable adjustment as per layout option.
 */
function ample_content_width()
{
    global $post;
    global $content_width;
    if ($post) {
        $layout_meta = get_post_meta($post->ID, 'ample_page_layout', true);
    }
    if (empty($layout_meta) || is_archive() || is_search()) {
        $layout_meta = 'default_layout';
    }
    $ample_default_layout = ample_option('ample_default_layout', 'right_sidebar');
    if ($layout_meta == 'default_layout') {
        if ($ample_default_layout == 'no_sidebar_full_width') {
            $content_width = 1100;
            /* pixels */
        } elseif ($ample_default_layout == 'both_sidebar') {
            $content_width = 500;
            /* pixels */
        } else {
            $content_width = 710;
            /* pixels */
        }
    } elseif ($layout_meta == 'no_sidebar_full_width') {
        $content_width = 1100;
        /* pixels */
    } elseif ($layout_meta == 'both_sidebar') {
        $content_width = 500;
        /* pixels */
    } else {
        $content_width = 710;
        /* pixels */
    }
}
 /**
  * Fucntion to select the sidebar
  */
 function ample_sidebar_select()
 {
     global $post;
     if ($post) {
         $layout_meta = get_post_meta($post->ID, 'ample_page_layout', true);
     }
     if (is_home()) {
         $queried_id = get_option('page_for_posts');
         $layout_meta = get_post_meta($queried_id, 'ample_page_layout', true);
     }
     if (empty($layout_meta) || is_archive() || is_search()) {
         $layout_meta = 'default_layout';
     }
     $ample_default_layout = ample_option('ample_default_layout', 'right_sidebar');
     $ample_default_page_layout = ample_option('ample_pages_default_layout', 'right_sidebar');
     $ample_default_post_layout = ample_option('ample_single_posts_default_layout', 'right_sidebar');
     if ($layout_meta == 'default_layout') {
         if (is_page()) {
             if ($ample_default_page_layout == 'right_sidebar' || $ample_default_page_layout == 'both_sidebar') {
                 get_sidebar();
             } elseif ($ample_default_page_layout == 'left_sidebar') {
                 get_sidebar('left');
             }
         }
         if (is_single()) {
             if ($ample_default_post_layout == 'right_sidebar' || $ample_default_post_layout == 'both_sidebar') {
                 get_sidebar();
             } elseif ($ample_default_post_layout == 'left_sidebar') {
                 get_sidebar('left');
             }
         } elseif ($ample_default_layout == 'right_sidebar' || $ample_default_layout == 'both_sidebar') {
             get_sidebar();
         } elseif ($ample_default_layout == 'left_sidebar') {
             get_sidebar('left');
         }
     } elseif ($layout_meta == 'right_sidebar' || $layout_meta == 'both_sidebar') {
         get_sidebar();
     } elseif ($layout_meta == 'left_sidebar') {
         get_sidebar('left');
     }
 }
get_search_form();
?>
               </div>
   	      </div>
   	   </div><!-- .main-head-wrap -->
         <?php 
if (ample_option('ample_header_image_position', 'above') == 'below') {
    ample_render_header_image();
}
?>
  	   </div><!-- .header -->
	</header><!-- end of header -->
   <div class="main-wrapper">

      <?php 
if (ample_option('ample_activate_slider', '0') == '1') {
    if (is_front_page()) {
        ?>
            <div class="slider-wrap">
               <?php 
        ample_featured_image_slider();
        ?>
               <div class="slider-tagline">
                  <div class="inner-wrap">
                     <h4>Making your dream home a reality..</h4>
                  </div>
               </div>
            </div>
         <?php 
    }
}
    /**
     * display slider
     */
    function ample_featured_image_slider()
    {
        ?>
   <div class="big-slider-wrapper">
      <div class="big-slider">
         <?php 
        for ($i = 1; $i <= 4; $i++) {
            $ample_slider_image = ample_option('ample_slider_image' . $i, '');
            $ample_slider_title = ample_option('ample_slider_title' . $i, '');
            $ample_slider_button_text = ample_option('ample_slider_button_text' . $i, '');
            $ample_slider_link = ample_option('ample_slider_link' . $i, '');
            if ($i == 1) {
                $classes = "slides displayblock";
            } else {
                $classes = "slides displaynone";
            }
            if (!empty($ample_slider_image)) {
                ?>
               <div class="<?php 
                echo $classes;
                ?>
">
                  <?php 
                if (!empty($ample_slider_title)) {
                    ?>
                     <div class="slider-entry-container">
                        <h3 class="entry-title">
                           <a href="<?php 
                    echo esc_url($ample_slider_link);
                    ?>
" title="<?php 
                    echo esc_attr($ample_slider_title);
                    ?>
"><?php 
                    echo $ample_slider_title;
                    ?>
</a>
                        </h3>
                        <?php 
                    if (!empty($ample_slider_button_text)) {
                        ?>
                        <div class="slider-link-btn">
                           <a class="slider-button" href="<?php 
                        echo esc_url($ample_slider_link);
                        ?>
" title="<?php 
                        echo esc_attr($ample_slider_title);
                        ?>
"> <?php 
                        echo $ample_slider_button_text;
                        ?>
                           </a>
                        </div>
                        <?php 
                    }
                    ?>
                     </div>
                  <?php 
                }
                ?>
                  <figure>
                     <img alt="<?php 
                echo esc_attr($ample_slider_title);
                ?>
" src="<?php 
                echo esc_url($ample_slider_image);
                ?>
" >
                  </figure>
               </div>
            <?php 
            }
        }
        ?>
      </div>
      <div class="slide-next"></div>
      <div class="slide-prev"></div>
   </div><!-- .big-slider-wrapper -->
<?php 
    }