/**
     * Echo the settings update form.
     *
     * @since 0.9.1
     *
     * @param array $instance Current settings
     */
    function form($instance)
    {
        //* Merge with defaults
        $instance = wp_parse_args((array) $instance, $this->defaults);
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'omega-featured-page');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" class="widefat" />
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('page_id');
        ?>
"><?php 
        _e('Page', 'omega-featured-page');
        ?>
:</label>
			<?php 
        wp_dropdown_pages(array('name' => $this->get_field_name('page_id'), 'selected' => $instance['page_id']));
        ?>
		</p>

		<hr class="div" />

		<p>
			<input id="<?php 
        echo $this->get_field_id('show_image');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_image');
        ?>
" value="1"<?php 
        checked($instance['show_image']);
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_image');
        ?>
"><?php 
        _e('Show Featured Image', 'omega-featured-page');
        ?>
</label>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('image_size');
        ?>
"><?php 
        _e('Image Size', 'omega-featured-page');
        ?>
:</label>
			<select id="<?php 
        echo $this->get_field_id('image_size');
        ?>
" class="omega-image-size-selector" name="<?php 
        echo $this->get_field_name('image_size');
        ?>
">
				<option value="thumbnail">thumbnail (<?php 
        echo absint(get_option('thumbnail_size_w'));
        ?>
x<?php 
        echo absint(get_option('thumbnail_size_h'));
        ?>
)</option>
				<?php 
        $sizes = omega_get_additional_image_sizes();
        foreach ((array) $sizes as $name => $size) {
            echo '<option value="' . esc_attr($name) . '" ' . selected($name, $instance['image_size'], FALSE) . '>' . esc_html($name) . ' (' . absint($size['width']) . 'x' . absint($size['height']) . ')</option>';
        }
        ?>
			</select>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('image_alignment');
        ?>
"><?php 
        _e('Image Alignment', 'omega-featured-page');
        ?>
:</label>
			<select id="<?php 
        echo $this->get_field_id('image_alignment');
        ?>
" name="<?php 
        echo $this->get_field_name('image_alignment');
        ?>
">
				<option value="alignnone">- <?php 
        _e('None', 'omega-featured-page');
        ?>
 -</option>
				<option value="alignleft" <?php 
        selected('alignleft', $instance['image_alignment']);
        ?>
><?php 
        _e('Left', 'omega-featured-page');
        ?>
</option>
				<option value="alignright" <?php 
        selected('alignright', $instance['image_alignment']);
        ?>
><?php 
        _e('Right', 'omega-featured-page');
        ?>
</option>
			</select>
		</p>

		<hr class="div" />

		<p>
			<input id="<?php 
        echo $this->get_field_id('show_title');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_title');
        ?>
" value="1"<?php 
        checked($instance['show_title']);
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_title');
        ?>
"><?php 
        _e('Show Page Title', 'omega-featured-page');
        ?>
</label>
		</p>

		<p>
			<input id="<?php 
        echo $this->get_field_id('show_content');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_content');
        ?>
" value="1"<?php 
        checked($instance['show_content']);
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_content');
        ?>
"><?php 
        _e('Show Page Content', 'omega-featured-page');
        ?>
</label>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('content_limit');
        ?>
"><?php 
        _e('Content Character Limit', 'omega-featured-page');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('content_limit');
        ?>
" name="<?php 
        echo $this->get_field_name('content_limit');
        ?>
" value="<?php 
        echo esc_attr($instance['content_limit']);
        ?>
" size="3" />
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('more_text');
        ?>
"><?php 
        _e('More Text', 'omega-featured-page');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('more_text');
        ?>
" name="<?php 
        echo $this->get_field_name('more_text');
        ?>
" value="<?php 
        echo esc_attr($instance['more_text']);
        ?>
" />
		</p>
		<?php 
    }
    /**
     * Echo the settings update form.
     *
     * @since 0.9.1
     *
     * @param array $instance Current settings
     */
    function form($instance)
    {
        //* Merge with defaults
        $instance = wp_parse_args((array) $instance, $this->defaults);
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'omega');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" class="widefat" />
		</p>

		<div class="omega-widget-column">

			<div class="omega-widget-column-box omega-widget-column-box-top">

				<p>
					<label for="<?php 
        echo $this->get_field_id('posts_cat');
        ?>
"><?php 
        _e('Category', 'omega');
        ?>
:</label>
					<?php 
        $categories_args = array('name' => $this->get_field_name('posts_cat'), 'selected' => $instance['posts_cat'], 'orderby' => 'Name', 'hierarchical' => 1, 'show_option_all' => __('All Categories', 'omega'), 'hide_empty' => '0');
        wp_dropdown_categories($categories_args);
        ?>
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('posts_num');
        ?>
"><?php 
        _e('Number of Posts to Show', 'omega');
        ?>
:</label>
					<input type="text" id="<?php 
        echo $this->get_field_id('posts_num');
        ?>
" name="<?php 
        echo $this->get_field_name('posts_num');
        ?>
" value="<?php 
        echo esc_attr($instance['posts_num']);
        ?>
" size="2" />
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('posts_offset');
        ?>
"><?php 
        _e('Number of Posts to Offset', 'omega');
        ?>
:</label>
					<input type="text" id="<?php 
        echo $this->get_field_id('posts_offset');
        ?>
" name="<?php 
        echo $this->get_field_name('posts_offset');
        ?>
" value="<?php 
        echo esc_attr($instance['posts_offset']);
        ?>
" size="2" />
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('orderby');
        ?>
"><?php 
        _e('Order By', 'omega');
        ?>
:</label>
					<select id="<?php 
        echo $this->get_field_id('orderby');
        ?>
" name="<?php 
        echo $this->get_field_name('orderby');
        ?>
">
						<option value="date" <?php 
        selected('date', $instance['orderby']);
        ?>
><?php 
        _e('Date', 'omega');
        ?>
</option>
						<option value="title" <?php 
        selected('title', $instance['orderby']);
        ?>
><?php 
        _e('Title', 'omega');
        ?>
</option>
						<option value="parent" <?php 
        selected('parent', $instance['orderby']);
        ?>
><?php 
        _e('Parent', 'omega');
        ?>
</option>
						<option value="ID" <?php 
        selected('ID', $instance['orderby']);
        ?>
><?php 
        _e('ID', 'omega');
        ?>
</option>
						<option value="comment_count" <?php 
        selected('comment_count', $instance['orderby']);
        ?>
><?php 
        _e('Comment Count', 'omega');
        ?>
</option>
						<option value="rand" <?php 
        selected('rand', $instance['orderby']);
        ?>
><?php 
        _e('Random', 'omega');
        ?>
</option>
					</select>
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('order');
        ?>
"><?php 
        _e('Sort Order', 'omega');
        ?>
:</label>
					<select id="<?php 
        echo $this->get_field_id('order');
        ?>
" name="<?php 
        echo $this->get_field_name('order');
        ?>
">
						<option value="DESC" <?php 
        selected('DESC', $instance['order']);
        ?>
><?php 
        _e('Descending (3, 2, 1)', 'omega');
        ?>
</option>
						<option value="ASC" <?php 
        selected('ASC', $instance['order']);
        ?>
><?php 
        _e('Ascending (1, 2, 3)', 'omega');
        ?>
</option>
					</select>
				</p>

				<p>
					<input id="<?php 
        echo $this->get_field_id('exclude_displayed');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('exclude_displayed');
        ?>
" value="1" <?php 
        checked($instance['exclude_displayed']);
        ?>
/>
					<label for="<?php 
        echo $this->get_field_id('exclude_displayed');
        ?>
"><?php 
        _e('Exclude Previously Displayed Posts?', 'omega');
        ?>
</label>
				</p>

			</div>

			<div class="omega-widget-column-box">

				<p>
					<input id="<?php 
        echo $this->get_field_id('show_gravatar');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_gravatar');
        ?>
" value="1" <?php 
        checked($instance['show_gravatar']);
        ?>
/>
					<label for="<?php 
        echo $this->get_field_id('show_gravatar');
        ?>
"><?php 
        _e('Show Author Gravatar', 'omega');
        ?>
</label>
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('gravatar_size');
        ?>
"><?php 
        _e('Gravatar Size', 'omega');
        ?>
:</label>
					<select id="<?php 
        echo $this->get_field_id('gravatar_size');
        ?>
" name="<?php 
        echo $this->get_field_name('gravatar_size');
        ?>
">
						<option value="45" <?php 
        selected(45, $instance['gravatar_size']);
        ?>
><?php 
        _e('Small (45px)', 'omega');
        ?>
</option>
						<option value="65" <?php 
        selected(65, $instance['gravatar_size']);
        ?>
><?php 
        _e('Medium (65px)', 'omega');
        ?>
</option>
						<option value="85" <?php 
        selected(85, $instance['gravatar_size']);
        ?>
><?php 
        _e('Large (85px)', 'omega');
        ?>
</option>
						<option value="125" <?php 
        selected(105, $instance['gravatar_size']);
        ?>
><?php 
        _e('Extra Large (125px)', 'omega');
        ?>
</option>
					</select>
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('gravatar_alignment');
        ?>
"><?php 
        _e('Gravatar Alignment', 'omega');
        ?>
:</label>
					<select id="<?php 
        echo $this->get_field_id('gravatar_alignment');
        ?>
" name="<?php 
        echo $this->get_field_name('gravatar_alignment');
        ?>
">
						<option value="alignnone">- <?php 
        _e('None', 'omega');
        ?>
 -</option>
						<option value="alignleft" <?php 
        selected('alignleft', $instance['gravatar_alignment']);
        ?>
><?php 
        _e('Left', 'omega');
        ?>
</option>
						<option value="alignright" <?php 
        selected('alignright', $instance['gravatar_alignment']);
        ?>
><?php 
        _e('Right', 'omega');
        ?>
</option>
					</select>
				</p>

			</div>

			<div class="omega-widget-column-box">

				<p>
					<input id="<?php 
        echo $this->get_field_id('show_image');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_image');
        ?>
" value="1" <?php 
        checked($instance['show_image']);
        ?>
/>
					<label for="<?php 
        echo $this->get_field_id('show_image');
        ?>
"><?php 
        _e('Show Featured Image', 'omega');
        ?>
</label>
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('image_size');
        ?>
"><?php 
        _e('Image Size', 'omega');
        ?>
:</label>
					<select id="<?php 
        echo $this->get_field_id('image_size');
        ?>
" class="omega-image-size-selector" name="<?php 
        echo $this->get_field_name('image_size');
        ?>
">
						<option value="thumbnail">thumbnail (<?php 
        echo get_option('thumbnail_size_w');
        ?>
x<?php 
        echo get_option('thumbnail_size_h');
        ?>
)</option>
						<?php 
        $sizes = omega_get_additional_image_sizes();
        foreach ((array) $sizes as $name => $size) {
            echo '<option value="' . esc_attr($name) . '" ' . selected($name, $instance['image_size'], FALSE) . '>' . esc_html($name) . ' ( ' . $size['width'] . 'x' . $size['height'] . ' )</option>';
        }
        ?>
					</select>
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('image_alignment');
        ?>
"><?php 
        _e('Image Alignment', 'omega');
        ?>
:</label>
					<select id="<?php 
        echo $this->get_field_id('image_alignment');
        ?>
" name="<?php 
        echo $this->get_field_name('image_alignment');
        ?>
">
						<option value="alignnone">- <?php 
        _e('None', 'omega');
        ?>
 -</option>
						<option value="alignleft" <?php 
        selected('alignleft', $instance['image_alignment']);
        ?>
><?php 
        _e('Left', 'omega');
        ?>
</option>
						<option value="alignright" <?php 
        selected('alignright', $instance['image_alignment']);
        ?>
><?php 
        _e('Right', 'omega');
        ?>
</option>
					</select>
				</p>

			</div>

		</div>

		<div class="omega-widget-column omega-widget-column-right">

			<div class="omega-widget-column-box omega-widget-column-box-top">

				<p>
					<input id="<?php 
        echo $this->get_field_id('show_title');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_title');
        ?>
" value="1" <?php 
        checked($instance['show_title']);
        ?>
/>
					<label for="<?php 
        echo $this->get_field_id('show_title');
        ?>
"><?php 
        _e('Show Post Title', 'omega');
        ?>
</label>
				</p>

				<p>
					<input id="<?php 
        echo $this->get_field_id('show_byline');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_byline');
        ?>
" value="1" <?php 
        checked($instance['show_byline']);
        ?>
/>
					<label for="<?php 
        echo $this->get_field_id('show_byline');
        ?>
"><?php 
        _e('Show Post Info', 'omega');
        ?>
</label>
					<input type="text" id="<?php 
        echo $this->get_field_id('post_info');
        ?>
" name="<?php 
        echo $this->get_field_name('post_info');
        ?>
" value="<?php 
        echo esc_attr($instance['post_info']);
        ?>
" class="widefat" />
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('show_content');
        ?>
"><?php 
        _e('Content Type', 'omega');
        ?>
:</label>
					<select id="<?php 
        echo $this->get_field_id('show_content');
        ?>
" name="<?php 
        echo $this->get_field_name('show_content');
        ?>
">
						<option value="content" <?php 
        selected('content', $instance['show_content']);
        ?>
><?php 
        _e('Show Content', 'omega');
        ?>
</option>
						<option value="excerpt" <?php 
        selected('excerpt', $instance['show_content']);
        ?>
><?php 
        _e('Show Excerpt', 'omega');
        ?>
</option>
						<option value="content-limit" <?php 
        selected('content-limit', $instance['show_content']);
        ?>
><?php 
        _e('Show Content Limit', 'omega');
        ?>
</option>
						<option value="" <?php 
        selected('', $instance['show_content']);
        ?>
><?php 
        _e('No Content', 'omega');
        ?>
</option>
					</select>
					<br />
					<label for="<?php 
        echo $this->get_field_id('content_limit');
        ?>
"><?php 
        _e('Limit content to', 'omega');
        ?>
						<input type="text" id="<?php 
        echo $this->get_field_id('image_alignment');
        ?>
" name="<?php 
        echo $this->get_field_name('content_limit');
        ?>
" value="<?php 
        echo esc_attr(intval($instance['content_limit']));
        ?>
" size="3" />
						<?php 
        _e('characters', 'omega');
        ?>
					</label>
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('more_text');
        ?>
"><?php 
        _e('More Text (if applicable)', 'omega');
        ?>
:</label>
					<input type="text" id="<?php 
        echo $this->get_field_id('more_text');
        ?>
" name="<?php 
        echo $this->get_field_name('more_text');
        ?>
" value="<?php 
        echo esc_attr($instance['more_text']);
        ?>
" />
				</p>

			</div>

			<div class="omega-widget-column-box">

				<p><?php 
        _e('To display an unordered list of more posts from this category, please fill out the information below', 'omega');
        ?>
:</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('extra_title');
        ?>
"><?php 
        _e('Title', 'omega');
        ?>
:</label>
					<input type="text" id="<?php 
        echo $this->get_field_id('extra_title');
        ?>
" name="<?php 
        echo $this->get_field_name('extra_title');
        ?>
" value="<?php 
        echo esc_attr($instance['extra_title']);
        ?>
" class="widefat" />
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('extra_num');
        ?>
"><?php 
        _e('Number of Posts to Show', 'omega');
        ?>
:</label>
					<input type="text" id="<?php 
        echo $this->get_field_id('extra_num');
        ?>
" name="<?php 
        echo $this->get_field_name('extra_num');
        ?>
" value="<?php 
        echo esc_attr($instance['extra_num']);
        ?>
" size="2" />
				</p>

			</div>

			<div class="omega-widget-column-box">

				<p>
					<input id="<?php 
        echo $this->get_field_id('more_from_category');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('more_from_category');
        ?>
" value="1" <?php 
        checked($instance['more_from_category']);
        ?>
/>
					<label for="<?php 
        echo $this->get_field_id('more_from_category');
        ?>
"><?php 
        _e('Show Category Archive Link', 'omega');
        ?>
</label>
				</p>

				<p>
					<label for="<?php 
        echo $this->get_field_id('more_from_category_text');
        ?>
"><?php 
        _e('Link Text', 'omega');
        ?>
:</label>
					<input type="text" id="<?php 
        echo $this->get_field_id('more_from_category_text');
        ?>
" name="<?php 
        echo $this->get_field_name('more_from_category_text');
        ?>
" value="<?php 
        echo esc_attr($instance['more_from_category_text']);
        ?>
" class="widefat" />
				</p>

			</div>

		</div>
		<?php 
    }
Example #3
0
/**
 * Returns all registered image sizes arrays, including the standard sizes.
 *
 * Returns a two-dimensional array of standard and additionally registered image
 * sizes, with width, height and crop sub-keys.
 *
 * Here, the standard sizes have their sub-keys populated by pulling from the
 * options saved in the database.
 *
 * @since 1.0.2
 *
 * @uses omega_get_additional_image_sizes()
 *
 * @return array Two-dimensional, with width, height and crop sub-keys
 */
function omega_get_image_sizes()
{
    $builtin_sizes = array('large' => array('width' => get_option('large_size_w'), 'height' => get_option('large_size_h')), 'medium' => array('width' => get_option('medium_size_w'), 'height' => get_option('medium_size_h')), 'thumbnail' => array('width' => get_option('thumbnail_size_w'), 'height' => get_option('thumbnail_size_h'), 'crop' => get_option('thumbnail_crop')));
    $additional_sizes = omega_get_additional_image_sizes();
    return array_merge($builtin_sizes, $additional_sizes);
}