コード例 #1
0
    ?>
</a></h2>
								<?php 
    get_template_part('postinfo');
    ?>
								<a href="<?php 
    the_permalink();
    ?>
" rel="nofollow" title="<?php 
    _e("Permanent Link to", "solostream");
    ?>
 <?php 
    the_title();
    ?>
"><?php 
    solostream_feature_image_wide();
    ?>
</a>
								<div class="excerpt">
									<?php 
    solostream_excerpt();
    ?>
								</div>
								<a href="<?php 
    the_permalink();
    ?>
" class="read_on" rel="nofollow" title="<?php 
    _e("Permanent Link to", "solostream");
    ?>
 <?php 
    the_title();
コード例 #2
0
    function widget($args, $instance)
    {
        extract($args);
        // If no title, use the name of the category.
        if (!$instance["title"]) {
            $category_info = get_category($instance["cat"]);
            $instance["title"] = $category_info->name;
        }
        /* Before widget (defined by themes). */
        echo $before_widget;
        $uniqueid = substr(md5(rand(0, 1000000)), 0, 4);
        $slideitems = $instance["slideitems"];
        ?>

		<script type="text/javascript">
		//<![CDATA[

			(function() {

				// store the slider in a local variable
				var $window = jQuery(window),flexslider;

				function getSlideItems() {
					return (window.innerWidth < 353) ? 1 :
					(window.innerWidth < 769) ? 2 :
					(window.innerWidth < 961) ? 3 : <?php 
        echo $instance["slideitems"];
        ?>
;
				}

				jQuery(window).load(function() {
					jQuery('#featured-cat-thumbnav-<?php 
        echo $uniqueid;
        ?>
').flexslider({
						animationLoop:true,
						animationSpeed:300,
						animation:'slide',
						slideshow: false,
						smoothHeight:true,
						controlNav:false,
						useCSS:false,
						itemWidth:100,
						itemMargin:0,
						minItems: getSlideItems(),
						maxItems: getSlideItems()
					});
				});

				// check grid size on resize event
				jQuery(window).resize(function() {
					var gridSize = getSlideItems();
				});

			}());

		//]]>
		</script>

		<div class="featured cat">

			<?php 
        // Widget title
        echo $before_title;
        if ($instance['title_link'] && $instance["cat"]) {
            echo '<a href="' . get_category_link($instance["cat"]) . '">' . $instance["title"] . '</a>';
        } else {
            echo $instance["title"];
        }
        echo $after_title;
        ?>

			<?php 
        if ($instance["description"]) {
            echo '<div class="catslide-description">' . esc_html($instance["description"]) . '</div>';
        }
        ?>

			<div id="featured-cat-thumbnav-<?php 
        echo $uniqueid;
        ?>
" class="myflexslider thumbnav <?php 
        echo $instance["cat"];
        ?>
">

				<ul class="slides">

					<?php 
        global $post;
        global $do_not_duplicate;
        $count = 1;
        if (empty($instance["nodupes"])) {
            $do_not_duplicate = NULL;
        }
        $my_query = new WP_Query(array('post__not_in' => $do_not_duplicate, 'cat' => $instance["cat"], 'posts_per_page' => $instance["num"]));
        while ($my_query->have_posts()) {
            $my_query->the_post();
            $do_not_duplicate[] = $post->ID;
            ?>

					<li>

						<div class="cat-container">

							<?php 
            if ($instance["post_image"]) {
                ?>
								<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                solostream_feature_image_wide();
                ?>
</a>
							<?php 
            }
            ?>

							<div class="catslide-content">

								<?php 
            if ($instance["post_title"]) {
                ?>
									<h3 class="post-title"><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></h3>
								<?php 
            }
            ?>

								<?php 
            if ($instance["post_author"] || $instance["post_date"] || $instance["post_cats"] || $instance["post_comments"]) {
                ?>
									<ul class="catslide-meta clearfix">
										<?php 
                if ($instance["post_author"]) {
                    ?>
<li class="catslide-author"><?php 
                    the_author_posts_link();
                    ?>
</li><?php 
                }
                if ($instance["post_date"]) {
                    ?>
<li class="catslide-date"><?php 
                    the_time(get_option('date_format'));
                    ?>
</li><?php 
                }
                if ($instance["post_cat"]) {
                    ?>
<li class="catslide-cat"><?php 
                    the_category(', ');
                    ?>
</li><?php 
                }
                if ($instance["post_comments"]) {
                    ?>
<li class="catslide-comment"><a href="<?php 
                    comments_link();
                    ?>
" rel="<?php 
                    _e("bookmark", "solostream");
                    ?>
" title="<?php 
                    _e("Comments for", "solostream");
                    ?>
 <?php 
                    the_title();
                    ?>
"><?php 
                    comments_number(__("0 Comments", "solostream"), __("1 Comment", "solostream"), __("% Comments", "solostream"));
                    ?>
</a></li><?php 
                }
                ?>
									</ul>
								<?php 
            }
            ?>

								<?php 
            if ($instance["show_content"] || $instance["read_more"]) {
                ?>
									<p class="catslide-excerpt">
										<?php 
                if ($instance["show_content"]) {
                    $excerpt = get_the_excerpt();
                    echo string_limit_words($excerpt, $instance['content_limit']);
                }
                ?>
										<?php 
                if ($instance["read_more"]) {
                    ?>
<a class="more-link" href="<?php 
                    the_permalink();
                    ?>
" rel="nofollow" title="<?php 
                    _e("Permanent Link to", "solostream");
                    ?>
 <?php 
                    the_title();
                    ?>
"><?php 
                    echo esc_html($instance['more_text']);
                    ?>
</a><?php 
                }
                ?>
									</p>
								<?php 
            }
            ?>

							</div>

						</div>

					</li>

					<?php 
            $count = $count + 1;
        }
        ?>

				</ul>

			</div>

		</div>

		<?php 
        if ($instance['bottomline']) {
            printf('<div class="column-clear line"></div>');
        }
        /* After widget (defined by themes). */
        echo $after_widget;
    }