Ejemplo n.º 1
0
    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 
        }
    }
Ejemplo n.º 2
0
						</ul>
					<?php 
}
?>

					<?php 
if (isset($maskitto_light['header-social']) && $maskitto_light['header-social']) {
    ?>
						<ul id="menu-header-menu-1" class="nav navbar-nav navbar-right navbar-secondary">
							<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-102"><a href="#"><?php 
    _e('Social links', 'maskitto-light');
    ?>
</a></li>
							<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-102 menu-social-icons">
								<?php 
    echo maskitto_light_social_icons();
    ?>
							</li>
						</ul>
					<?php 
}
?>

				</div>
			</div>

		</nav>

	</header>
	<div id="wrapper">