コード例 #1
0
ファイル: admin.php プロジェクト: hscale/webento
/**
 * This function generates the form code to be used in the metaboxes
 *
 * @since 0.9
 */
function genesis_slider_options_box()
{
    ?>

			<div id="genesis-slider-content-type">

				<h4><?php 
    _e('Type of Content', 'genesis-slider');
    ?>
</h4>

				<p><label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[post_type]"><?php 
    _e('Would you like to use posts or pages', 'genesis-slider');
    ?>
?</label>
					<select id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[post_type]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[post_type]">
<?php 
    $post_types = get_post_types(array('public' => true), 'names', 'and');
    $post_types = array_filter($post_types, 'genesis_slider_exclude_post_types');
    foreach ($post_types as $post_type) {
        ?>

							<option style="padding-right:10px;" value="<?php 
        echo esc_attr($post_type);
        ?>
" <?php 
        selected(esc_attr($post_type), genesis_get_slider_option('post_type'));
        ?>
><?php 
        echo esc_attr($post_type);
        ?>
</option><?php 
    }
    ?>

					</select></p>

			</div>

			<div id="genesis-slider-content-filter">

				<div id="genesis-slider-taxonomy">

					<p><strong style="display: block; font-size: 11px; margin-top: 10px;"><?php 
    _e('By Taxonomy and Terms', 'genesis-slider');
    ?>
</strong><label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[posts_term]"><?php 
    _e('Choose a term to determine what slides to include', 'genesis-slider');
    ?>
.</label>

						<select id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[posts_term]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[posts_term]" style="margin-top: 5px;">

							<option style="padding-right:10px;" value="" <?php 
    selected('', genesis_get_slider_option('posts_term'));
    ?>
><?php 
    _e('All Taxonomies and Terms', 'genesis-slider');
    ?>
</option>
			<?php 
    $taxonomies = get_taxonomies(array('public' => true), 'objects');
    $taxonomies = array_filter($taxonomies, 'genesis_slider_exclude_taxonomies');
    $test = get_taxonomies(array('public' => true), 'objects');
    foreach ($taxonomies as $taxonomy) {
        $query_label = '';
        if (!empty($taxonomy->query_var)) {
            $query_label = $taxonomy->query_var;
        } else {
            $query_label = $taxonomy->name;
        }
        ?>
								<optgroup label="<?php 
        echo esc_attr($taxonomy->labels->name);
        ?>
">

									<option style="margin-left: 5px; padding-right:10px;" value="<?php 
        echo esc_attr($query_label);
        ?>
" <?php 
        selected(esc_attr($query_label), genesis_get_slider_option('posts_term'));
        ?>
><?php 
        echo $taxonomy->labels->all_items;
        ?>
</option><?php 
        $terms = get_terms($taxonomy->name, 'orderby=name&hide_empty=1');
        foreach ($terms as $term) {
            ?>
									<option style="margin-left: 8px; padding-right:10px;" value="<?php 
            echo esc_attr($query_label) . ',' . $term->slug;
            ?>
" <?php 
            selected(esc_attr($query_label) . ',' . $term->slug, genesis_get_slider_option('posts_term'));
            ?>
><?php 
            echo '-' . esc_attr($term->name);
            ?>
</option><?php 
        }
        ?>

								</optgroup> <?php 
    }
    ?>

						</select>
					</p>

					<p><strong style="display: block; font-size: 11px; margin-top: 10px;"><?php 
    _e('Exclude by Taxonomy ID', 'genesis-slider');
    ?>
</strong></p>

					<p>
						<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[exclude_terms]"><?php 
    printf(__('List which category, tag or other taxonomy IDs to exclude. (1,2,3,4 for example)', 'genesis-slider'), '<br />');
    ?>
</label>
					</p>

					<p>
						<input type="text" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[exclude_terms]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[exclude_terms]" value="<?php 
    echo esc_attr(genesis_get_slider_option('exclude_terms'));
    ?>
" style="width:60%;" />
					</p>

				</div>

				<p>
					<strong style="font-size:11px;margin-top:10px;"><label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[include_exclude]"><?php 
    printf(__('Include or Exclude by %s ID', 'genesis-slider'), genesis_get_slider_option('post_type'));
    ?>
</label></strong>
				</p>

				<p><?php 
    _e('Choose the include / exclude slides using their post / page ID in a comma-separated list. (1,2,3,4 for example)', 'genesis-slider');
    ?>
</p>

				<p>
					<select style="margin-top: 5px;" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[include_exclude]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[include_exclude]">
						<option style="padding-right:10px;" value="" <?php 
    selected('', genesis_get_slider_option('include_exclude'));
    ?>
><?php 
    _e('Select', 'genesis-slider');
    ?>
</option>
						<option style="padding-right:10px;" value="include" <?php 
    selected('include', genesis_get_slider_option('include_exclude'));
    ?>
><?php 
    _e('Include', 'genesis-slider');
    ?>
</option>
						<option style="padding-right:10px;" value="exclude" <?php 
    selected('exclude', genesis_get_slider_option('include_exclude'));
    ?>
><?php 
    _e('Exclude', 'genesis-slider');
    ?>
</option>
					</select>
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[post_id]"><?php 
    _e('List which', 'genesis-slider');
    ?>
 <strong><?php 
    echo genesis_get_slider_option('post_type') . ' ' . __('ID', 'genesis-slider');
    ?>
s</strong> <?php 
    _e('to include / exclude. (1,2,3,4 for example)', 'genesis-slider');
    ?>
</label></p>
				<p>
					<input type="text" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[post_id]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[post_id]" value="<?php 
    echo esc_attr(genesis_get_slider_option('post_id'));
    ?>
" style="width:60%;" />
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[posts_num]"><?php 
    _e('Number of Slides to Show', 'genesis-slider');
    ?>
:</label>
					<input type="text" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[posts_num]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[posts_num]" value="<?php 
    echo esc_attr(genesis_get_slider_option('posts_num'));
    ?>
" size="2" />
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[posts_offset]"><?php 
    _e('Number of Posts to Offset', 'genesis-slider');
    ?>
:</label>
					<input type="text" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[posts_offset]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[posts_offset]" value="<?php 
    echo esc_attr(genesis_get_slider_option('posts_offset'));
    ?>
" size="2" />
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[orderby]"><?php 
    _e('Order By', 'genesis-slider');
    ?>
:</label>
					<select id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[orderby]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[orderby]">
						<option style="padding-right:10px;" value="date" <?php 
    selected('date', genesis_get_slider_option('orderby'));
    ?>
><?php 
    _e('Date', 'genesis-slider');
    ?>
</option>
						<option style="padding-right:10px;" value="title" <?php 
    selected('title', genesis_get_slider_option('orderby'));
    ?>
><?php 
    _e('Title', 'genesis-slider');
    ?>
</option>
						<option style="padding-right:10px;" value="ID" <?php 
    selected('ID', genesis_get_slider_option('orderby'));
    ?>
><?php 
    _e('ID', 'genesis-slider');
    ?>
</option>
						<option style="padding-right:10px;" value="menu_order" <?php 
    selected('menu_order', genesis_get_slider_option('orderby'));
    ?>
><?php 
    _e('Menu Order', 'genesis-slider');
    ?>
</option>
						<option style="padding-right:10px;" value="rand" <?php 
    selected('rand', genesis_get_slider_option('orderby'));
    ?>
><?php 
    _e('Random', 'genesis-slider');
    ?>
</option>
					</select>
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[order]"><?php 
    _e('Order', 'genesis-slider');
    ?>
:</label>
					<select id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[order]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[order]">
						<option style="padding-right:10px;" value="DESC" <?php 
    selected('DESC', genesis_get_slider_option('order'));
    ?>
><?php 
    _e('Descending', 'genesis-slider');
    ?>
</option>
						<option style="padding-right:10px;" value="ASC" <?php 
    selected('ASC', genesis_get_slider_option('order'));
    ?>
><?php 
    _e('Ascending', 'genesis-slider');
    ?>
</option>
					</select>
				</p>
			</div>

			<hr class="div" />

			<h4><?php 
    _e('Transition Settings', 'genesis-slider');
    ?>
</h4>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_timer]"><?php 
    _e('Time Between Slides (in milliseconds)', 'genesis-slider');
    ?>
:
					<input type="text" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_timer]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_timer]" value="<?php 
    echo genesis_get_slider_option('slideshow_timer');
    ?>
" size="5" /></label>
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_delay]"><?php 
    _e('Slide Transition Speed (in milliseconds)', 'genesis-slider');
    ?>
:
					<input type="text" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_delay]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_delay]" value="<?php 
    echo genesis_get_slider_option('slideshow_delay');
    ?>
" size="5" /></label>
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_effect]"><?php 
    _e('Slider Effect', 'genesis-slider');
    ?>
:
					<?php 
    _e('Select one of the following:', 'genesis-slider');
    ?>
					<select name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_effect]" id="<?php 
    echo GENESIS_SETTINGS_FIELD;
    ?>
[slideshow_effect]">
						<option value="right" <?php 
    selected('right', genesis_get_slider_option('slideshow_effect'));
    ?>
><?php 
    _e('Scroll right', 'genesis-slider');
    ?>
</option>
						<option value="left" <?php 
    selected('left', genesis_get_slider_option('slideshow_effect'));
    ?>
><?php 
    _e('Scroll left', 'genesis-slider');
    ?>
</option>
						<option value="down" <?php 
    selected('down', genesis_get_slider_option('slideshow_effect'));
    ?>
><?php 
    _e('Scroll down', 'genesis-slider');
    ?>
</option>
						<option value="up" <?php 
    selected('up', genesis_get_slider_option('slideshow_effect'));
    ?>
><?php 
    _e('Scroll up', 'genesis-slider');
    ?>
</option>
						<option value="fade" <?php 
    selected('fade', genesis_get_slider_option('slideshow_effect'));
    ?>
><?php 
    _e('Fade', 'genesis-slider');
    ?>
</option>
						<option value="wipe" <?php 
    selected('wipe', genesis_get_slider_option('slideshow_effect'));
    ?>
><?php 
    _e('Wipe', 'genesis-slider');
    ?>
</option>
						<option value="cover-up" <?php 
    selected('cover-up', genesis_get_slider_option('slideshow_effect'));
    ?>
><?php 
    _e('Cover up', 'genesis-slider');
    ?>
</option>
						<option value="cover-down" <?php 
    selected('cover-down', genesis_get_slider_option('slideshow_effect'));
    ?>
><?php 
    _e('Cover down', 'genesis-slider');
    ?>
</option>
						<option value="cover-left" <?php 
    selected('cover-left', genesis_get_slider_option('slideshow_effect'));
    ?>
><?php 
    _e('Cover left', 'genesis-slider');
    ?>
</option>
						<option value="cover-right" <?php 
    selected('cover-right', genesis_get_slider_option('slideshow_effect'));
    ?>
><?php 
    _e('Cover right', 'genesis-slider');
    ?>
</option>
					</select>
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_loop]"><?php 
    _e('Scroll Loop (only applies to scroll options)', 'genesis-slider');
    ?>
:
					<select name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_loop]" id="<?php 
    echo GENESIS_SETTINGS_FIELD;
    ?>
[slideshow_loop]">
						<option value="0" <?php 
    selected('0', genesis_get_slider_option('slideshow_loop'));
    ?>
><?php 
    _e('Rewind slides', 'genesis-slider');
    ?>
</option>
						<option value="1" <?php 
    selected('1', genesis_get_slider_option('slideshow_loop'));
    ?>
><?php 
    _e('Loop slides', 'genesis-slider');
    ?>
</option>
					</select>
				</p>

			<hr class="div" />

			<h4><?php 
    _e('Display Settings', 'genesis-slider');
    ?>
</h4>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_width]"><?php 
    _e('Slider Width (in pixels)', 'genesis-slider');
    ?>
:
					<input type="text" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_width]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_width]" value="<?php 
    echo genesis_get_slider_option('slideshow_width');
    ?>
" size="5" /></label>
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_height]"><?php 
    _e('Slider Height (in pixels)', 'genesis-slider');
    ?>
:
					<input type="text" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_height]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_height]" value="<?php 
    echo genesis_get_slider_option('slideshow_height');
    ?>
" size="5" /></label>
				</p>

				<p>
					<?php 
    _e('Navigation', 'genesis-slider');
    ?>
:
					<label><input type="radio" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_arrows]" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_arrows]" value="0" <?php 
    checked(0, genesis_get_slider_option('slideshow_arrows'));
    ?>
 /> <?php 
    _e('None', 'genesis-slider');
    ?>
</label>
					<label><input type="radio" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_arrows]" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_arrows]" value="1" <?php 
    checked(1, genesis_get_slider_option('slideshow_arrows'));
    ?>
 /> <?php 
    _e('Arrows', 'genesis-slider');
    ?>
</label>
				</p>

			<hr class="div" />

			<h4><?php 
    _e('Content Settings', 'genesis-slider');
    ?>
</h4>

				<p>
					<input type="checkbox" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_no_link]" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_title_show]" value="1" <?php 
    checked(1, genesis_get_slider_option('slideshow_no_link'));
    ?>
 /> <label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_no_link]"><?php 
    _e('Do not link Slider image to Post/Page.', 'genesis-slider');
    ?>
</label>
				</p>

				<p>
					<input type="checkbox" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_title_show]" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_title_show]" value="1" <?php 
    checked(1, genesis_get_slider_option('slideshow_title_show'));
    ?>
 /> <label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_title_show]"><?php 
    _e('Display Post/Page Title in Slider?', 'genesis-slider');
    ?>
</label>
				</p>
				<p>
					<input type="checkbox" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_show]" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_show]" value="1" <?php 
    checked(1, genesis_get_slider_option('slideshow_excerpt_show'));
    ?>
 /> <label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_show]"><?php 
    _e('Display Content in Slider?', 'genesis-slider');
    ?>
</label>
				</p>
				
				<p>
					<?php 
    _e('Select one of the following:', 'genesis-slider');
    ?>
					<select name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_content]" id="<?php 
    echo GENESIS_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_content]">
						<option value="full" <?php 
    selected('full', genesis_get_slider_option('slideshow_excerpt_content'));
    ?>
><?php 
    _e('Display post content', 'genesis-slider');
    ?>
</option>
						<option value="excerpts" <?php 
    selected('excerpts', genesis_get_slider_option('slideshow_excerpt_content'));
    ?>
><?php 
    _e('Display post excerpts', 'genesis-slider');
    ?>
</option>
					</select>
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_more_text]"><?php 
    _e('More Text (if applicable)', 'genesis-slider');
    ?>
:</label>
					<input type="text" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_more_text]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_more_text]" value="<?php 
    echo esc_attr(genesis_get_slider_option('slideshow_more_text'));
    ?>
" />
				</p>
			
				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_content_limit]"><?php 
    _e('Limit content to', 'genesis-slider');
    ?>
</label>
					<input type="text" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_content_limit]" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_content_limit]" value="<?php 
    echo esc_attr(genesis_get_slider_option('slideshow_excerpt_content_limit'));
    ?>
" size="3" />
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_content_limit]"><?php 
    _e('characters', 'genesis-slider');
    ?>
</label>
				</p>
		
				<p><span class="description"><?php 
    _e('Using this option will limit the text and strip all formatting from the text displayed. To use this option, choose "Display post content" in the select box above.', 'genesis-slider');
    ?>
</span></p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_width]"><?php 
    _e('Slider Excerpt Width (in pixels)', 'genesis-slider');
    ?>
:
					<input type="text" id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_width]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[slideshow_excerpt_width]" value="<?php 
    echo genesis_get_slider_option('slideshow_excerpt_width');
    ?>
" size="5" /></label>
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[location_vertical]"><?php 
    _e('Excerpt Location (vertical)', 'genesis-slider');
    ?>
:</label>
					<select id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[location_vertical]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[location_vertical]">
						<option style="padding-right:10px;" value="top" <?php 
    selected('top', genesis_get_slider_option('location_vertical'));
    ?>
><?php 
    _e('Top', 'genesis-slider');
    ?>
</option>
						<option style="padding-right:10px;" value="bottom" <?php 
    selected('bottom', genesis_get_slider_option('location_vertical'));
    ?>
><?php 
    _e('Bottom', 'genesis-slider');
    ?>
</option>
					</select>
				</p>

				<p>
					<label for="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[location_horizontal]"><?php 
    _e('Excerpt Location (horizontal)', 'genesis-slider');
    ?>
:</label>
					<select id="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[location_horizontal]" name="<?php 
    echo GENESIS_SLIDER_SETTINGS_FIELD;
    ?>
[location_horizontal]">
						<option style="padding-right:10px;" value="left" <?php 
    selected('left', genesis_get_slider_option('location_horizontal'));
    ?>
><?php 
    _e('Left', 'genesis-slider');
    ?>
</option>
						<option style="padding-right:10px;" value="right" <?php 
    selected('right', genesis_get_slider_option('location_horizontal'));
    ?>
><?php 
    _e('Right', 'genesis-slider');
    ?>
</option>
					</select>
				</p>
<?php 
}
コード例 #2
0
ファイル: plugin.php プロジェクト: erikpatton/pattonwebdesign
    function widget($args, $instance)
    {
        extract($args);
        echo $before_widget;
        $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $term_args = array();
        if ('page' != genesis_get_slider_option('post_type')) {
            if (genesis_get_slider_option('posts_term')) {
                $posts_term = explode(',', genesis_get_slider_option('posts_term'));
                if ('category' == $posts_term['0']) {
                    $posts_term['0'] = 'category_name';
                }
                if ('post_tag' == $posts_term['0']) {
                    $posts_term['0'] = 'tag';
                }
                if (isset($posts_term['1'])) {
                    $term_args[$posts_term['0']] = $posts_term['1'];
                }
            }
            if (!empty($posts_term['0'])) {
                if ('category' == $posts_term['0']) {
                    $taxonomy = 'category';
                } elseif ('post_tag' == $posts_term['0']) {
                    $taxonomy = 'post_tag';
                } else {
                    $taxonomy = $posts_term['0'];
                }
            } else {
                $taxonomy = 'category';
            }
            if (genesis_get_slider_option('exclude_terms')) {
                $exclude_terms = explode(',', str_replace(' ', '', genesis_get_slider_option('exclude_terms')));
                $term_args[$taxonomy . '__not_in'] = $exclude_terms;
            }
        }
        if (genesis_get_slider_option('posts_offset')) {
            $myOffset = genesis_get_slider_option('posts_offset');
            $term_args['offset'] = $myOffset;
        }
        if (genesis_get_slider_option('post_id')) {
            $IDs = explode(',', str_replace(' ', '', genesis_get_slider_option('post_id')));
            if ('include' == genesis_get_slider_option('include_exclude')) {
                $term_args['post__in'] = $IDs;
            } else {
                $term_args['post__not_in'] = $IDs;
            }
        }
        $query_args = array_merge($term_args, array('post_type' => genesis_get_slider_option('post_type'), 'posts_per_page' => genesis_get_slider_option('posts_num'), 'orderby' => genesis_get_slider_option('orderby'), 'order' => genesis_get_slider_option('order'), 'meta_key' => genesis_get_slider_option('meta_key')));
        $query_args = apply_filters('genesis_slider_query_args', $query_args);
        $effect = genesis_get_slider_option('slideshow_effect');
        $scroll = '';
        if (empty($effect) || in_array($effect, array('up', 'down', 'left', 'right'))) {
            $scroll = 'genesis-slider-scroll';
        }
        add_filter('excerpt_more', 'genesis_slider_excerpt_more');
        ?>

		<div id="genesis-slider">
			<div class="genesis-slider-wrap <?php 
        echo $scroll;
        ?>
">

				<div id="slides">
					<?php 
        $controller = '';
        $slider_posts = new WP_Query($query_args);
        if ($slider_posts->have_posts()) {
            $show_excerpt = genesis_get_slider_option('slideshow_excerpt_show');
            $show_title = genesis_get_slider_option('slideshow_title_show');
            $show_type = genesis_get_slider_option('slideshow_excerpt_content');
            $show_limit = genesis_get_slider_option('slideshow_excerpt_content_limit');
            $more_text = genesis_get_slider_option('slideshow_more_text');
            $no_image_link = genesis_get_slider_option('slideshow_no_link');
        }
        while ($slider_posts->have_posts()) {
            $slider_posts->the_post();
            $controller .= '<span class="jFlowControl"></span>';
            ?>

					<div class="slide-wrap">
					<?php 
            if ($show_excerpt == 1 || $show_title == 1) {
                ?>
					
						<div class="slide-excerpt slide-<?php 
                the_ID();
                ?>
">
							<div class="slide-background"></div><!-- end .slide-background -->
							<div class="slide-excerpt-border ">
								<?php 
                if ($show_title == 1) {
                    ?>

								<h2><a href="<?php 
                    the_permalink();
                    ?>
" rel="bookmark"><?php 
                    the_title();
                    ?>
</a></h2>
								<?php 
                }
                if ($show_excerpt) {
                    if ($show_type != 'full') {
                        the_excerpt();
                    } elseif ($show_limit) {
                        the_content_limit((int) $show_limit, esc_html($more_text));
                    } else {
                        the_content(esc_html($more_text));
                    }
                }
                ?>

							</div><!-- end .slide-excerpt-border  -->
						</div><!-- end .slide-excerpt -->
					<?php 
            }
            ?>

						<div class="slide-image">
					<?php 
            if ($no_image_link) {
                genesis_image('format=html&size=slider');
            } else {
                ?>
							<a href="<?php 
                the_permalink();
                ?>
" rel="bookmark"><?php 
                genesis_image('format=html&size=slider');
                ?>
</a>
					<?php 
            }
            // $no_image_link
            ?>
						</div><!-- end .slide-image -->

					</div><!-- end .slide-wrap -->
				<?php 
        }
        ?>

				</div><!-- end #slides -->

				<div class="myController">
					<?php 
        echo $controller;
        ?>
				</div><!-- end #myController -->

				<div class="slider-previous"></div>
				<div class="slider-next"></div>

			</div><!-- end .genesis-slider-wrap -->
		</div><!-- end #genesis-slider -->

<?php 
        echo $after_widget;
        remove_filter('excerpt_more', 'genesis_slider_excerpt_more');
        wp_reset_query();
    }