function maskitto_light_generate_page($id, $front = 0)
    {
        $posts = new WP_Query(array('p' => $id, 'post_type' => 'page'));
        while ($posts->have_posts()) {
            $posts->the_post();
            $title = get_the_title();
            $content = get_the_content();
            $content = do_shortcode(apply_filters('the_content', $content));
        }
        wp_reset_postdata();
        if ($id > 0) {
            $style1 = (string) NULL;
            $style2 = (string) NULL;
            $style3 = (string) NULL;
            $subtitle = esc_attr(get_post_meta($id, 'wpcf-subtitle', true));
            $titlebar = esc_attr(get_post_meta($id, 'wpcf-title-layout', true));
            $title_color = esc_attr(get_post_meta($id, 'wpcf-title-color', true));
            $background_color = esc_attr(get_post_meta($id, 'wpcf-background-color', true));
            $background_image = esc_url(get_post_meta($id, 'wpcf-background-image', true));
            $padding = esc_attr(get_post_meta($id, 'wpcf-page-padding', true));
            $readmore = esc_attr(get_post_meta($id, 'wpcf-read-more', true));
            $button_name = esc_attr(get_post_meta($id, 'wpcf-button-name', true));
            $button_url = esc_url(get_post_meta($id, 'wpcf-button-url', true));
            if (!$button_url) {
                $button_url = '#';
            }
            $button_icon = esc_attr(get_post_meta($id, 'wpcf-button-icon', true));
            $button_type = esc_attr(get_post_meta($id, 'wpcf-button-tone', true));
            $googlemaps_image = esc_url(get_post_meta($id, 'wpcf-google-maps-image', true));
            $googlemaps_url = esc_url(get_post_meta($id, 'wpcf-google-maps-url', true));
            $googlemaps_height = esc_attr(get_post_meta($id, 'wpcf-google-maps-height', true));
            //$sociallinks = esc_attr( get_post_meta( $id, 'wpcf-social-links', true ));
            $page_template = esc_attr(get_post_meta($id, '_wp_page_template', true));
            $parallax = esc_attr(get_post_meta(get_the_ID(), 'wpcf-background-image-parallax', true));
            if ($padding == 'small') {
                $style1 .= "padding: 35px 0;";
            } else {
                if ($padding == 'large') {
                    $style1 .= "padding: 150px 0;";
                }
            }
            if ($background_color) {
                $style1 .= "background-color: {$background_color};";
            }
            if ($background_image) {
                $style1 .= "background-image: url({$background_image});";
            }
            if ($title_color) {
                $style2 .= "color: {$title_color};";
            }
            if ($googlemaps_height == 'extrasmall') {
                $style3 .= "height: 200px;";
            } else {
                if ($googlemaps_height == 'small') {
                    $style3 .= "height: 325px;";
                } else {
                    if ($googlemaps_height == 'large') {
                        $style3 .= "height: 550px;";
                    } else {
                        if ($googlemaps_height == 'extralarge') {
                            $style3 .= "height: 750px;";
                        } else {
                            $style3 .= "height: 450px;";
                        }
                    }
                }
            }
            /* Check content for widgets */
            $widgets_count = 0;
            preg_match('/div class="page-section"/s', $content, $matches);
            if (count($matches) > 0) {
                $style1 .= "padding-bottom: 0px!important;";
                $widgets_count = count($matches);
            }
            ?>
	        <div id="page-id-<?php 
            echo $id;
            ?>
" class="page-section<?php 
            echo $parallax ? ' parallax-simple' : '';
            ?>
" style="<?php 
            echo $style1;
            ?>
">
	            <div class="container page-list<?php 
            echo !$subtitle ? ' page-no-subtitle' : '';
            ?>
">


	                <?php 
            if ($titlebar == 'small') {
                ?>

	                    <h4 class="page-node text-center" style="<?php 
                echo $style2;
                ?>
">
	                        <?php 
                echo $title;
                ?>
	                        <?php 
                echo maskitto_light_admin_edit($id);
                ?>
	                    </h4>
	                    <?php 
                if ($content && $widgets_count == 0 && $page_template != 'template-contact.php') {
                    ?>
	                        <div class="page-node section-content" style="<?php 
                    echo $style2;
                    ?>
">
	                            <div class="post-inner" style=" font-size: 13px; padding-top: 10px;">
	                                <?php 
                    echo $content;
                    ?>
	                            </div>
	                        </div>
	                    <?php 
                }
                ?>

	                <?php 
            } elseif ($titlebar == 'large') {
                ?>

	                    <div class="page-node section-title-large text-center">
	                        <div class="title" style="<?php 
                echo $style2;
                ?>
">
	                            <?php 
                echo $title;
                ?>
	                            <?php 
                echo maskitto_light_admin_edit($id);
                ?>
	                        </div>
	                    </div>
	                    <?php 
                if ($content && $widgets_count == 0 && $page_template != 'template-contact.php') {
                    ?>
	                        <div class="page-node section-content-large" style="<?php 
                    echo $style2;
                    ?>
">
	                            <div class="post-inner">
	                                <?php 
                    echo $content;
                    ?>
	                            </div>
	                        </div>
	                    <?php 
                }
                ?>

	                <?php 
            } else {
                ?>

	                    <?php 
                if ($titlebar != 'none') {
                    ?>
	                        <div class="page-node section-title text-center">
	                            <h3 style="<?php 
                    echo $style2;
                    ?>
">
	                                <?php 
                    echo $title;
                    ?>
	                                <?php 
                    echo maskitto_light_admin_edit($id);
                    ?>
	                            </h3>

	                            <?php 
                    if ($subtitle) {
                        ?>
	                                <div class="subtitle">
	                                    <p><?php 
                        echo $subtitle;
                        ?>
</p>
	                                </div>
	                            <?php 
                    }
                    ?>

	                            <?php 
                    if ($titlebar || $subtitle) {
                        ?>
	                                <div class="section-title-line"></div>
	                            <?php 
                    }
                    ?>
	                        </div>
	                    <?php 
                } elseif (current_user_can('edit_post', $id)) {
                    ?>
	                        <div class="page-node text-center" style="margin-bottom: 10px;"><?php 
                    echo maskitto_light_admin_edit($id);
                    ?>
</div>
	                    <?php 
                }
                ?>

	                    <?php 
                if ($content && $widgets_count == 0 && $page_template != 'template-contact.php') {
                    ?>
	                        <div class="page-node section-content" style="<?php 
                    echo $style2;
                    ?>
">
	                            <div class="post-inner">
	                                <?php 
                    echo $content;
                    ?>
	                            </div>
	                        </div>
	                    <?php 
                }
                ?>

	                <?php 
            }
            ?>


	                <?php 
            if ($page_template == 'template-contact.php' && $googlemaps_height) {
                ?>
	                    <div class="page-node contact-section">
	                        <div>
	                        	<div class="post-inner"><?php 
                echo $content;
                ?>
</div>
	                        </div>
	                        <?php 
                global $maskitto_light;
                if (isset($maskitto_light['contacts-social-icons']) && $maskitto_light['contacts-social-icons'] == 1) {
                    ?>
	                            <div class="contact-social-icons">  
	                                <?php 
                    echo maskitto_light_social_icons();
                    ?>
	                            </div>
	                        <?php 
                }
                ?>
	                    </div>
	                <?php 
            }
            ?>
            


	                <?php 
            if ($button_name) {
                ?>
	                    <a href="<?php 
                echo $button_url;
                ?>
" class="btn btn-default page-node section-button section-button-<?php 
                echo $button_type;
                ?>
">
	                        <?php 
                if ($button_icon) {
                    ?>
	                            <i class="fa <?php 
                    echo $button_icon;
                    ?>
"></i>
	                        <?php 
                }
                ?>
	                        <?php 
                echo $button_name;
                ?>
	                    </a>
	                <?php 
            }
            ?>
	                

					<?php 
            if ($front == 1) {
                ?>
		                <?php 
                if ($readmore && !preg_match('/<!--more(.*?)?-->/', get_post_field('post_content', $id))) {
                    ?>
		                    <a href="<?php 
                    echo esc_url(get_permalink($id));
                    ?>
" class="btn btn-default page-node">
		                        <i class="fa fa-angle-right"></i>
		                        <?php 
                    _e('Read more', 'maskitto-light');
                    ?>
		                    </a>
		                <?php 
                }
                ?>
	                <?php 
            }
            ?>
	            </div>
	        </div>


	        <?php 
            if ($googlemaps_url) {
                ?>
	            <div class="page-section googlemap" style="<?php 
                echo $style3;
                ?>
">
	                <a href="<?php 
                echo $googlemaps_url;
                ?>
" target="_blank" class="google-maps-image" style="background-image: url(<?php 
                echo $googlemaps_image;
                ?>
);"></a>
	                <div class="googlemap-loading"><i class="fa fa-circle-o-notch fa-spin"></i></div>
	            </div>
	        <?php 
            }
            ?>


		<?php 
        }
    }
    public function widget($args, $instance)
    {
        $testimonials = wp_count_posts('testimonials');
        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
        $subtitle = isset($instance['subtitle']) ? esc_attr($instance['subtitle']) : '';
        $remove_border = isset($instance['remove_border']) ? intval($instance['remove_border']) : '';
        $limit = isset($instance['limit']) ? intval($instance['limit']) : '';
        $widget_group = isset($instance['widget_group']) ? esc_attr($instance['widget_group']) : '';
        if (isset($testimonials->publish) && $testimonials->publish > 0) {
            if (!isset($instance['limit']) || !$instance['limit']) {
                $limit = 3;
            }
            ?>

    <?php 
            echo $args['before_widget'];
            ?>
        <div class="page-section page-section-testimoninals">
            <div class="container">

                <?php 
            if ($title || $subtitle) {
                ?>
                <div class="section-title text-center">
                    <?php 
                if ($title) {
                    ?>
                        <h3><?php 
                    echo $title;
                    ?>
</h3>
                    <?php 
                }
                ?>
                    <?php 
                if ($subtitle) {
                    ?>
                        <div class="subtitle"><p><?php 
                    echo $subtitle;
                    ?>
</p></div>
                    <?php 
                }
                ?>
                    <div class="section-title-line"></div>
                </div>
                <?php 
            }
            ?>


                <div class="testimonials-list">
                    <?php 
            $i = 1;
            $loop_array = array('post_type' => 'testimonials', 'posts_per_page' => $limit);
            if (isset($widget_group) && $widget_group != '') {
                $loop_array2 = array('tax_query' => array(array('taxonomy' => 'testimonials-group', 'field' => 'slug', 'terms' => $widget_group)));
                $loop_array = array_merge($loop_array, $loop_array2);
            }
            $loop = new WP_Query($loop_array);
            while ($loop->have_posts()) {
                $loop->the_post();
                $quote = esc_attr(get_post_meta(get_the_ID(), 'wpcf-quote', true));
                $author_descr = esc_attr(get_post_meta(get_the_ID(), 'wpcf-author-description', true));
                $image = esc_url(get_post_meta(get_the_ID(), 'wpcf-quote-image', true));
                ?>

                        <div class="testimonials-item">
                            <div class="testimonials-image" style="background-image: url(<?php 
                echo $image;
                ?>
);"></div>
                            <div class="text-center"><?php 
                echo maskitto_light_admin_edit(get_the_ID());
                ?>
</div>
                            <div class="testimonials-text"><i><?php 
                echo $quote;
                ?>
</i></div>
                            <div class="testimonials-author"><?php 
                the_title();
                if (get_the_title() && $author_descr) {
                    echo ' / ';
                }
                echo $author_descr;
                ?>
</div>
                            <div class="testimonials-icon"><i class="fa fa-quote-right"></i></div>
                        </div>

                    <?php 
            }
            ?>
                </div>


                <div class="row services-list <?php 
            if ($remove_border) {
                echo 'services-list-no-border';
            }
            ?>
" style="display: none;">
                    <?php 
            $i = 1;
            $loop_array = array('post_type' => 'testimonials', 'posts_per_page' => $limit);
            if (isset($widget_group) && $widget_group != '') {
                $loop_array2 = array('tax_query' => array(array('taxonomy' => 'testimonials-group', 'field' => 'slug', 'terms' => $widget_group)));
                $loop_array = array_merge($loop_array, $loop_array2);
            }
            $loop = new WP_Query($loop_array);
            while ($loop->have_posts()) {
                $loop->the_post();
                $url = esc_url(get_post_meta(get_the_ID(), 'wpcf-url', true));
                ?>
                        <div class="col-md-4 text-center service-item">

                            <?php 
                if ($url) {
                    ?>
                                <a href="<?php 
                    echo $url;
                    ?>
" class="grey">
                            <?php 
                }
                ?>

                                <div class="service-column-left">
                                    <div class="service-line"></div>
                                    <div class="service-icon">
                                        <i class="fa <?php 
                $icon = get_post_meta(get_the_ID(), 'wpcf-icon', true);
                if ($icon) {
                    echo $icon;
                } else {
                    echo 'fa-pencil';
                }
                ?>
"></i>
                                    </div>
                                    <div class="service-line-bottom"></div>
                                </div>
                                <div class="service-column-right">
                                    <h5><?php 
                the_title();
                echo maskitto_light_admin_edit(get_the_ID());
                ?>
</h5>
                                    <?php 
                the_content();
                ?>
                                    <?php 
                if ($url) {
                    ?>
                                        <a href="<?php 
                    echo $url;
                    ?>
" class="services-readmore"><?php 
                    _e('Read more', 'maskitto-light');
                    ?>
</a>
                                    <?php 
                }
                ?>
                                </div>

                            <?php 
                if ($url) {
                    ?>
                                </a>
                            <?php 
                }
                ?>

                        </div>

                        <?php 
                if ($i % 3 == 0) {
                    ?>
                            </div>
                            <div class="row services-list">
                        <?php 
                }
                $i++;
                ?>

                    <?php 
            }
            ?>
                </div>
            </div>
        </div>
    <?php 
            echo $args['after_widget'];
            ?>

    <?php 
        }
    }
    public function widget($args, $instance)
    {
        $testimonials = wp_count_posts('testimonials');
        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
        $subtitle = isset($instance['subtitle']) ? esc_attr($instance['subtitle']) : '';
        $remove_border = isset($instance['remove_border']) ? intval($instance['remove_border']) : '';
        $limit = isset($instance['limit']) ? intval($instance['limit']) : '';
        $widget_group = isset($instance['widget_group']) ? esc_attr($instance['widget_group']) : '';
        if (isset($testimonials->publish) && $testimonials->publish > 0) {
            if (!isset($instance['limit']) || !$instance['limit']) {
                $limit = 3;
            }
            ?>

    <?php 
            echo $args['before_widget'];
            ?>
        <div class="page-section page-section-testimoninals">
            <div class="container">

                <?php 
            if ($title || $subtitle) {
                ?>
                <div class="section-title text-center">
                    <?php 
                if ($title) {
                    ?>
                        <h3><?php 
                    echo $title;
                    ?>
</h3>
                    <?php 
                }
                ?>
                    <?php 
                if ($subtitle) {
                    ?>
                        <div class="subtitle"><p><?php 
                    echo $subtitle;
                    ?>
</p></div>
                    <?php 
                }
                ?>
                    <div class="section-title-line"></div>
                </div>
                <?php 
            }
            ?>

                <div class="testimonials-list">
                    <?php 
            $i = 1;
            $loop_array = array('post_type' => 'testimonials', 'posts_per_page' => $limit);
            if (isset($widget_group) && $widget_group != '') {
                $loop_array2 = array('tax_query' => array(array('taxonomy' => 'testimonials-group', 'field' => 'slug', 'terms' => $widget_group)));
                $loop_array = array_merge($loop_array, $loop_array2);
            }
            $loop = new WP_Query($loop_array);
            while ($loop->have_posts()) {
                $loop->the_post();
                $quote = esc_attr(get_post_meta(get_the_ID(), 'wpcf-quote', true));
                $author_descr = esc_attr(get_post_meta(get_the_ID(), 'wpcf-author-description', true));
                $image = esc_url(get_post_meta(get_the_ID(), 'wpcf-quote-image', true));
                ?>

                        <div class="testimonials-item">
                            <div class="testimonials-image" style="background-image: url(<?php 
                echo $image;
                ?>
);"></div>
                            <div class="text-center"><?php 
                echo maskitto_light_admin_edit(get_the_ID());
                ?>
</div>
                            <div class="testimonials-text"><i><?php 
                echo $quote;
                ?>
</i></div>
                            <div class="testimonials-author"><?php 
                the_title();
                if (get_the_title() && $author_descr) {
                    echo ' / ';
                }
                echo $author_descr;
                ?>
</div>
                            <div class="testimonials-icon"><i class="fa fa-quote-right"></i></div>
                        </div>

                    <?php 
            }
            ?>
                </div>

            </div>
        </div>
    <?php 
            echo $args['after_widget'];
            ?>

    <?php 
        }
    }
</a>
            <?php 
        }
        ?>
        <?php 
    }
    ?>


        <div class="blog-top">
            <span class="blog-title" style="font-size: 21px;">
                <?php 
    the_title();
    ?>
                <?php 
    echo maskitto_light_admin_edit(get_the_ID());
    ?>
            </span>
        
            <div class="row">
                <div class="col-md-6 col-sm-6 blog-details" style="padding-left: 0;">
                    <span style="padding-right: 6px;"><?php 
    echo get_the_date();
    ?>
</span>
                    <span class="post-author-name"><?php 
    _e('By', 'maskitto-light');
    ?>
 <?php 
    echo get_the_author();
    ?>
示例#5
0
    public function widget($args, $instance)
    {
        $sliders = wp_count_posts('slider');
        if (isset($sliders->publish) && $sliders->publish > 0) {
            $widget_group = isset($instance['widget_group']) ? esc_attr($instance['widget_group']) : '';
            $desktop_height = isset($instance['desktop_height']) ? esc_attr($instance['desktop_height']) : '';
            ?>

        <?php 
            if ($desktop_height > 400) {
                ?>
            <style type="text/css">

                /* Custom slideshow height */
                @media (min-width: 1070px) {

                    #wrapper .page-slideshow {
                        height: <?php 
                echo $desktop_height;
                ?>
px;
                        max-height: <?php 
                echo $desktop_height;
                ?>
px;
                    }

                }

            </style>
        <?php 
            }
            ?>


        <div class="page-slideshow widget-slider-<?php 
            if ($widget_group) {
                echo $widget_group;
            } else {
                echo 'all';
            }
            ?>
">
            <i class="fa fa-circle-o-notch fa-spin"></i>
            <div class="slideshow">
                <?php 
            $loop_array = array('post_type' => 'slider');
            if (isset($widget_group) && $widget_group != '') {
                $loop_array2 = array('tax_query' => array(array('taxonomy' => 'slider-group', 'field' => 'slug', 'terms' => $widget_group)));
                $loop_array = array_merge($loop_array, $loop_array2);
            }
            $loop = new WP_Query($loop_array);
            while ($loop->have_posts()) {
                $loop->the_post();
                $class1 = (string) NULL;
                $class2 = (string) NULL;
                $style1 = (string) NULL;
                $image = esc_url(get_post_meta(get_the_ID(), 'wpcf-background-image', true));
                $caption = esc_attr(get_post_meta(get_the_ID(), 'wpcf-caption', true));
                $caption2 = esc_attr(get_post_meta(get_the_ID(), 'wpcf-caption2', true));
                $button_name = esc_attr(get_post_meta(get_the_ID(), 'wpcf-button-name', true));
                $button_url = esc_url(get_post_meta(get_the_ID(), 'wpcf-button-url', true));
                if (!$button_url) {
                    $button_url = '#';
                }
                $button_icon = esc_attr(get_post_meta(get_the_ID(), 'wpcf-button-icon', true));
                $button_name2 = esc_attr(get_post_meta(get_the_ID(), 'wpcf-button-name2', true));
                $button_url2 = esc_url(get_post_meta(get_the_ID(), 'wpcf-button-url2', true));
                if (!$button_url2) {
                    $button_url2 = '#';
                }
                $button_icon2 = esc_attr(get_post_meta(get_the_ID(), 'wpcf-button-icon2', true));
                $background_color = esc_attr(get_post_meta(get_the_ID(), 'wpcf-background-color', true));
                $background_shadow = esc_attr(get_post_meta(get_the_ID(), 'wpcf-background-shadow', true));
                $background_pattern = esc_attr(get_post_meta(get_the_ID(), 'wpcf-background-texture', true));
                $caption_background = esc_attr(get_post_meta(get_the_ID(), 'wpcf-caption-background', true));
                $align_horizontal = esc_attr(get_post_meta(get_the_ID(), 'wpcf-text-horizontal', true));
                $align_vertical = esc_attr(get_post_meta(get_the_ID(), 'wpcf-text-vertical', true));
                if (!$background_shadow) {
                    $class1 .= ' remove-shadow';
                }
                if ($image) {
                    $style1 .= "background-image: url({$image});";
                }
                if ($background_color) {
                    $style1 .= "background-color: {$background_color};";
                }
                if ($background_pattern) {
                    $class2 .= ' slide-patern-show';
                }
                if ($align_vertical == 'top') {
                    $class2 .= ' slide-align-top';
                }
                if ($align_horizontal == 'left') {
                    $class2 .= ' slide-align-left';
                } else {
                    if ($align_horizontal == 'right') {
                        $class2 .= ' slide-align-right';
                    }
                }
                if ($caption_background) {
                    $class2 .= ' caption-background';
                }
                ?>
                    <div class="<?php 
                if (class_exists("Jetpack")) {
                    echo 'sh-';
                }
                ?>
slideshow-slide<?php 
                echo $class1;
                ?>
" style="<?php 
                echo $style1;
                ?>
">
                        <div class="slide-patern<?php 
                echo $class2;
                ?>
">
                            <div class="container">
                                <div class="slide-details">
                                    <div><?php 
                echo maskitto_light_admin_edit(get_the_ID());
                ?>
</div>
                                
                                    <?php 
                if ($caption2) {
                    ?>
                                        <div class="slide-info2"><?php 
                    echo $caption2;
                    ?>
</div>
                                    <?php 
                }
                ?>

                                    <div class="slide-title"><?php 
                the_title();
                ?>
</div>
                                    <div></div>
                                    <?php 
                if ($caption) {
                    ?>
                                        <div class="slide-info"><?php 
                    echo $caption;
                    ?>
</div>
                                    <?php 
                }
                ?>
                                    <?php 
                if ($button_name || $button_name2) {
                    ?>
                                        <div class="slide-button">
                                            <?php 
                    if ($button_name) {
                        ?>
                                                <a href="<?php 
                        echo $button_url;
                        ?>
" class="btn btn-danger">
                                                    <?php 
                        if ($button_icon) {
                            ?>
                                                        <i class="fa <?php 
                            echo $button_icon;
                            ?>
"></i>
                                                    <?php 
                        }
                        ?>
                                                    <?php 
                        echo $button_name;
                        ?>
                                                </a>
                                            <?php 
                    }
                    ?>

                                            <?php 
                    if ($button_name2) {
                        ?>
                                                <a href="<?php 
                        echo $button_url2;
                        ?>
" class="btn btn-white">
                                                    <?php 
                        if ($button_icon2) {
                            ?>
                                                        <i class="fa <?php 
                            echo $button_icon2;
                            ?>
"></i>
                                                    <?php 
                        }
                        ?>
                                                    <?php 
                        echo $button_name2;
                        ?>
                                                </a>
                                            <?php 
                    }
                    ?>
                                        </div>
                                    <?php 
                }
                ?>
                                </div>
                            </div>
                        </div>
                    </div>
                <?php 
            }
            ?>
            </div>
        </div>


    <?php 
        }
    }