Ejemplo n.º 1
0
/**
 * Registers custom sections, settings, and controls for the $wp_customize instance.
 *
 * @since 0.3.2
 * @access private
 * @param object $wp_customize
 */
function omega_customize_post_register($wp_customize)
{
    /* Add the post section. */
    $wp_customize->add_section('post_section', array('title' => esc_html__('Posts', 'omega'), 'priority' => 120, 'capability' => 'edit_theme_options'));
    /* Add the 'content_archive' setting. */
    $wp_customize->add_setting("post_excerpt", array('default' => 'full', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field'));
    /* Add the checkbox control for the 'content_archive' setting. */
    $wp_customize->add_control('post_excerpt', array('priority' => 1, 'type' => 'select', 'label' => '', 'section' => 'post_section', 'settings' => 'post_excerpt', 'choices' => array('full' => 'Display full post', 'excerpts' => 'Display post excerpts')));
    /* Add the 'no_more_link_scroll' setting. */
    $wp_customize->add_setting("more_scroll", array('default' => '1', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field'));
    /* Add the checkbox control for the 'more_link_scroll' setting. */
    $wp_customize->add_control(new Omega_Customize_Control_Checkbox($wp_customize, 'more_scroll', array('priority' => 2, 'type' => 'checkbox', 'label' => esc_html__('More Link Page Scroll', 'omega'), 'section' => 'post_section', 'settings' => 'more_scroll', 'extra' => esc_html__('By default, clicking the .more-link anchor opens and scrolls the page to section of the document containing the named anchor. This section is where you put the <!--more--> tag within a post type.', 'omega'))));
    /* Add the 'content_archive_limit' setting. */
    $wp_customize->add_setting("excerpt_chars_limit", array('default' => '0', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field'));
    /* Add the checkbox control for the 'content_archive_limit' setting. */
    $wp_customize->add_control(new Omega_Customize_Control_Char($wp_customize, 'excerpt_chars_limit', array('priority' => 3, 'label' => esc_html__('Limit content to', 'omega'), 'section' => 'post_section', 'settings' => 'excerpt_chars_limit', 'extra' => esc_html__('Select "Display post excerpts" will limit the text and strip all formatting from the text displayed. Set 0 characters will display the first 55 words (default)', 'omega'))));
    /* Add the 'more_text' setting. */
    $wp_customize->add_setting("more_text", array('default' => '[Read more...]', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field'));
    /* Add the checkbox control for the 'more_text' setting. */
    $wp_customize->add_control('more_text', array('priority' => 4, 'type' => 'text', 'label' => esc_html__('More Text', 'omega'), 'section' => 'post_section', 'settings' => 'more_text'));
    /* Add the 'content_archive_thumbnail' setting. */
    $wp_customize->add_setting("post_thumbnail", array('default' => '1', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field'));
    /* Add the checkbox control for the 'content_archive_thumbnail' setting. */
    $wp_customize->add_control('post_thumbnail', array('priority' => 5, 'type' => 'checkbox', 'label' => esc_html__('Include the Featured Image?', 'omega'), 'section' => 'post_section', 'settings' => 'post_thumbnail'));
    /* Add the 'image_size' setting. */
    $wp_customize->add_setting("image_size", array('default' => 'large', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field'));
    /* Add the checkbox control for the 'image_size' setting. */
    $sizes = omega_get_image_sizes();
    $imagesizes = array();
    foreach ((array) $sizes as $name => $size) {
        $imagesizes[esc_attr($name)] = esc_attr($name) . ' (' . absint($size['width']) . ' &#x000D7; ' . absint($size['height']) . ')';
    }
    $wp_customize->add_control('image_size', array('priority' => 6, 'type' => 'select', 'label' => esc_html__('Image size', 'omega'), 'section' => 'post_section', 'settings' => 'image_size', 'choices' => $imagesizes));
    /* Add the 'no_more_link_scroll' setting. */
    $wp_customize->add_setting("single_nav", array('default' => '1', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field'));
    /* Add the checkbox control for the 'more_link_scroll' setting. */
    $wp_customize->add_control('single_nav', array('priority' => 7, 'type' => 'checkbox', 'label' => esc_html__('Enable single post Prev Next navigation links?', 'omega'), 'section' => 'post_section', 'settings' => 'single_nav'));
    wp_enqueue_style('omega-customizer', trailingslashit(OMEGA_CSS) . "customizer.css");
}
Ejemplo n.º 2
0
/**
 * Callback for Theme Settings Post Archives meta box.
 */
function omega_meta_box_theme_display_archives()
{
    ?>
	<p>
		<label for="<?php 
    echo omega_settings_field_id('content_archive');
    ?>
"><?php 
    _e('Select one of the following:', 'omega');
    ?>
</label>
		<select name="<?php 
    echo omega_settings_field_name('content_archive');
    ?>
" id="<?php 
    echo omega_settings_field_id('content_archive');
    ?>
">
		<?php 
    $archive_display = apply_filters('omega_archive_display_options', array('full' => __('Display full post', 'omega'), 'excerpts' => __('Display post excerpts', 'omega')));
    foreach ((array) $archive_display as $value => $name) {
        echo '<option value="' . esc_attr($value) . '"' . selected(omega_get_setting('content_archive'), esc_attr($value), false) . '>' . esc_html($name) . '</option>' . "\n";
    }
    ?>
		</select>
	</p>

	<div id="omega_more_link_scroll" <?php 
    if ('full' != omega_get_setting('content_archive')) {
        echo 'class="hidden"';
    }
    ?>
>
	<p>
		<label for="<?php 
    echo omega_settings_field_id('more_link_scroll');
    ?>
"><input type="checkbox" name="<?php 
    echo omega_settings_field_name('more_link_scroll');
    ?>
" id="<?php 
    echo omega_settings_field_id('more_link_scroll');
    ?>
" value="1" <?php 
    checked(omega_get_setting('more_link_scroll'));
    ?>
 />
		<?php 
    _e('Prevent page scroll when clicking the More Link', 'omega');
    ?>
</label>
	</p>
	</div>

	<div id="omega_content_limit_setting" <?php 
    if ('full' == omega_get_setting('content_archive')) {
        echo 'class="hidden"';
    }
    ?>
>
		<p>
			<label for="<?php 
    echo omega_settings_field_id('content_archive_limit');
    ?>
"><?php 
    _e('Limit content to', 'omega');
    ?>
			<input type="text" name="<?php 
    echo omega_settings_field_name('content_archive_limit');
    ?>
" id="<?php 
    echo omega_settings_field_id('content_archive_limit');
    ?>
" value="<?php 
    echo esc_attr(omega_get_setting('content_archive_limit'));
    ?>
" size="3" />
			<?php 
    _e('characters', 'omega');
    ?>
</label>
		</p>

		<p><span class="description"><?php 
    _e('Select "Display post excerpts" will limit the text and strip all formatting from the text displayed. Set 0 characters will display the first 55 words (default)', 'omega');
    ?>
</span></p>
	</div>

	<p>
		<?php 
    _e('More Text (if applicable):', 'omega');
    ?>
 <input type="text" name="<?php 
    echo omega_settings_field_name('content_archive_more');
    ?>
" id="<?php 
    echo omega_settings_field_id('content_archive_more');
    ?>
" value="<?php 
    echo esc_attr(omega_get_setting('content_archive_more'));
    ?>
" size="25" />			
	</p>

	<p class="collapsed">
		<label for="<?php 
    echo omega_settings_field_id('content_archive_thumbnail');
    ?>
"><input type="checkbox" name="<?php 
    echo omega_settings_field_name('content_archive_thumbnail');
    ?>
" id="<?php 
    echo omega_settings_field_id('content_archive_thumbnail');
    ?>
" value="1" <?php 
    checked(omega_get_setting('content_archive_thumbnail'));
    ?>
 />
		<?php 
    _e('Include the Featured Image?', 'omega');
    ?>
</label>
	</p>

	<p id="omega_image_size" <?php 
    if (!omega_get_setting('content_archive_thumbnail')) {
        echo 'class="hidden"';
    }
    ?>
>
		<label for="<?php 
    echo omega_settings_field_id('image_size');
    ?>
"><?php 
    _e('Image Size:', 'omega');
    ?>
</label>
		<select name="<?php 
    echo omega_settings_field_name('image_size');
    ?>
" id="<?php 
    echo omega_settings_field_id('image_size');
    ?>
">
		<?php 
    $sizes = omega_get_image_sizes();
    foreach ((array) $sizes as $name => $size) {
        echo '<option value="' . esc_attr($name) . '"' . selected(omega_get_setting('image_size'), $name, FALSE) . '>' . esc_html($name) . ' (' . absint($size['width']) . ' &#x000D7; ' . absint($size['height']) . ')</option>' . "\n";
    }
    ?>
		</select>
	</p>
	<p>
		<label for="<?php 
    echo omega_settings_field_id('posts_nav');
    ?>
"><?php 
    _e('Select Post Navigation Format:', 'omega');
    ?>
</label>
		<select name="<?php 
    echo omega_settings_field_name('posts_nav');
    ?>
" id="<?php 
    echo omega_settings_field_id('posts_nav');
    ?>
">
			<option value="prev-next"<?php 
    selected('prev-next', omega_get_setting('posts_nav'));
    ?>
><?php 
    _e('Previous / Next', 'omega');
    ?>
</option>
			<option value="numeric"<?php 
    selected('numeric', omega_get_setting('posts_nav'));
    ?>
><?php 
    _e('Numeric', 'omega');
    ?>
</option>
		</select>
	</p>
	<p><span class="description"><?php 
    _e('These options will affect any blog listings page, including archive, author, blog, category, search, and tag pages.', 'omega');
    ?>
</span></p>	
	<p>
		<label for="<?php 
    echo omega_settings_field_id('single_nav');
    ?>
"><input type="checkbox" name="<?php 
    echo omega_settings_field_name('single_nav');
    ?>
" id="<?php 
    echo omega_settings_field_id('single_nav');
    ?>
" value="1" <?php 
    checked(omega_get_setting('single_nav'));
    ?>
 />
		<?php 
    _e('Disable single post navigation link?', 'omega');
    ?>
</label>
	</p>

<?php 
}