function vwpc_render_editor()
    {
        // Show / Hide the editor on loading
        global $post;
        // if ( ! is_page() ) return;
        if (isset($post->ID) && 'page_composer.php' == get_post_meta($post->ID, '_wp_page_template', TRUE)) {
            ?>
			<style>#postdivrich{ display:none; }</style>
		<?php 
        } else {
            ?>
			<style>#vwpc-container{ display:none; }</style>
		<?php 
        }
        ?>

		<div id="vwpc-container">
			<input type="hidden" name="vwpc_is_enabled" value="1">

			<div class="vwpc-toolbox">
				<div class="dropdown">
					<button class="button button-primary button-large dropdown-toggle" type="button" id="add-section-button" data-toggle="dropdown">
						<?php 
        _e('Add Section', 'envirra-backend');
        ?>
						<span class="caret"></span>
					</button>
					<ul class="dropdown-menu" role="menu" aria-labelledby="add-section-button"></ul>
				</div>
			</div>

			<div class="vwpc-sections">
				<div class="vwpc-section-empty"><?php 
        _e('Click <strong>Add Section</strong> button to add new section.', 'envirra');
        ?>
</div>
				<div class="vwpc-section-loading"><i class="icon-entypo-arrows-ccw"></i> <?php 
        _e('Loading ...', 'envirra-backend');
        ?>
</div>
			</div>

			<!-- Section Template -->
			<script id="vwpc-template-section" type="text/template">
				<div class="vwpc-section">
					<input type="hidden" class="vwpc-section-order" name="vwpc_section_order[]">
					<input type="hidden" class="vwpc-section-type">
					<div class="vwpc-section-bar">
						<div class="vwpc-section-toolbox">
							<a class="vwpc-section-open-option" href="#"><i class="icon-entypo-cog"></i></a>
							<a class="vwpc-section-delete-section" href="#"><i class="icon-entypo-cancel"></i></a>
						</div>
						<i class="vwpc-section-handle icon-entypo-arrow-combo"></i>
						<div class="vwpc-section-label"></div>
					</div>
					<div class="vwpc-section-options hidden"></div>
				</div>
			</script>

			<script id="vwpc-template-section-option" type="text/template">
				<div class="vwpc-section-option vwpc-section-option-2-columns">
					<div class="vwpc-section-option-label-wrapper">
						<label class="vwpc-section-option-label"></label>
						<div class="vwpc-section-option-description"></div>
					</div>
					<div class="vwpc-section-option-field-wrapper"></div>
				</div>
			</script>

			<!-- Fields Template -->
			<script id="vwpc-template-field-text" type="text/template">
				<input class="vwpc-field" type="text">
			</script>

			<script id="vwpc-template-field-number" type="text/template">
				<input class="vwpc-field" type="number" name="quantity" min="1">
			</script>

			<script id="vwpc-template-field-checkbox" type="text/template">
				<input class="vwpc-field" type="hidden">
				<label>
					<input class="vwpc-field" type="checkbox">
					<span></span>
				</label>
			</script>

			<script id="vwpc-template-field-select" type="text/template">
				<select class="vwpc-field"></select>
			</script>

			<script id="vwpc-template-field-category" type="text/template">
				<?php 
        wp_dropdown_categories(array('hide_empty' => 0, 'class' => 'vwpc-field', 'hierarchical' => true));
        ?>
			</script>

			<script id="vwpc-template-field-category_with_all_option" type="text/template">
				<?php 
        wp_dropdown_categories(array('show_option_all' => __('All', 'envirra'), 'hide_empty' => 0, 'class' => 'vwpc-field', 'hierarchical' => true));
        ?>
			</script>

			<script id="vwpc-template-field-categories" type="text/template">
				<ul class="vw-category-checklist vwpc-field">
					<?php 
        $walker = new Vw_Walker_Category_Checklist();
        $walker->set_field_name('selected_cats');
        wp_category_checklist(0, 0, array(), false, $walker);
        ?>
				</ul>
			</script>

			<script id="vwpc-template-field-sidebar" type="text/template">
				<select>
					<option value="0"><?php 
        echo __('None', 'envirra-backend');
        ?>
</option>
				<?php 
        foreach ($GLOBALS['wp_registered_sidebars'] as $sidebar) {
            ?>
					<option value="<?php 
            echo esc_attr(ucwords($sidebar['id']));
            ?>
">
						<?php 
            echo ucwords($sidebar['name']);
            ?>
					</option>
				<?php 
        }
        ?>
				</select>
			</script>

			<script id="vwpc-template-field-html" type="text/template">
				<textarea class="vwpc-field"></textarea>
			</script>
		</div>
		<?php 
    }
Example #2
0
    function form($instance)
    {
        $instance = wp_parse_args((array) $instance, $this->default);
        $supertitle = strip_tags($instance['supertitle']);
        $title = strip_tags($instance['title']);
        $show_count = $instance['show_count'] ? 'checked="checked"' : '';
        // $show_description = $instance['show_description'] ? 'checked="checked"' : '';
        $show_posts = $instance['show_posts'] ? 'checked="checked"' : '';
        $selected_cats = $instance['selected_cats'];
        ?>

		<!-- super title -->
		<p>
			<label for="<?php 
        echo $this->get_field_id('supertitle');
        ?>
"><?php 
        _e('Super-title:', 'envirra-backend');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('supertitle');
        ?>
" name="<?php 
        echo $this->get_field_name('supertitle');
        ?>
" type="text" value="<?php 
        echo esc_attr($supertitle);
        ?>
" />
		</p>

		<!-- title -->
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'envirra-backend');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($title);
        ?>
" />
		</p>

		<!-- show count -->
		<p>
			<input class="checkbox" type="checkbox" <?php 
        echo $show_count;
        ?>
 id="<?php 
        echo $this->get_field_id('show_count');
        ?>
" name="<?php 
        echo $this->get_field_name('show_count');
        ?>
" />
			<label for="<?php 
        echo $this->get_field_id('show_count');
        ?>
"><?php 
        _e('Show post counts', 'envirra-backend');
        ?>
</label>
		</p>

		<!-- show description -->
		<!-- <p>
			<input class="checkbox" type="checkbox" <?php 
        echo $show_description;
        ?>
 id="<?php 
        echo $this->get_field_id('show_description');
        ?>
" name="<?php 
        echo $this->get_field_name('show_description');
        ?>
" />
			<label for="<?php 
        echo $this->get_field_id('show_description');
        ?>
"><?php 
        _e('Show description', 'envirra-backend');
        ?>
</label>
		</p> -->

		<!-- show latest posts -->
		<p>
			<input class="checkbox" type="checkbox" <?php 
        echo $show_posts;
        ?>
 id="<?php 
        echo $this->get_field_id('show_posts');
        ?>
" name="<?php 
        echo $this->get_field_name('show_posts');
        ?>
" />
			<label for="<?php 
        echo $this->get_field_id('show_posts');
        ?>
"><?php 
        _e('Show latest posts (Only post contains featured image)', 'envirra-backend');
        ?>
</label>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('selected_cats');
        ?>
"><?php 
        _e('Select Categories (No select for all):', 'envirra-backend');
        ?>
</label>
			<ul class="vw-category-checklist" id="<?php 
        echo $this->get_field_id('selected_cats');
        ?>
" name="<?php 
        echo $this->get_field_name('selected_cats');
        ?>
">
				<?php 
        $walker = new Vw_Walker_Category_Checklist();
        $walker->set_field_name($this->get_field_name('selected_cats'));
        wp_category_checklist(0, 0, $selected_cats, false, $walker);
        ?>
			</ul>
		</p>

		<?php 
    }