コード例 #1
0
ファイル: news_tabs.php プロジェクト: daanbakker1995/vanteun
    function widget($args, $instance)
    {
        extract($args);
        $posts = $instance['posts'];
        $comments = $instance['comments'];
        $tags_count = $instance['tags'];
        $show_popular_posts = isset($instance['show_popular_posts']) ? 'true' : 'false';
        $show_recent_posts = isset($instance['show_recent_posts']) ? 'true' : 'false';
        $show_comments = isset($instance['show_comments']) ? 'true' : 'false';
        $show_tags = isset($instance['show_tags']) ? 'true' : 'false';
        $extra_class = !empty($instance['extra_class']) ? $instance['extra_class'] : "";
        // no 'class' attribute - add one with the value of width
        if (strpos($before_widget, 'class') === false) {
            $before_widget = str_replace('>', 'class="' . $extra_class . '"', $before_widget);
        } else {
            $before_widget = str_replace('class="', 'class="' . $extra_class . ' ', $before_widget);
        }
        echo $before_widget;
        ?>
        <div class="tab-holder">
            <div class="tab-hold tabs-wrapper">
                <ul id="tabs" class="nav nav-tabs">
                    <?php 
        if ($show_popular_posts == 'true') {
            ?>
                        <li class="active"><a href="#tab1" data-toggle="tab"><?php 
            echo __('Popular', THEMENAME);
            ?>
</a></li>
                    <?php 
        }
        ?>
                    <?php 
        if ($show_recent_posts == 'true') {
            ?>
                        <li><a href="#tab2" data-toggle="tab"><?php 
            echo __('Recent', THEMENAME);
            ?>
</a></li>
                    <?php 
        }
        ?>
                    <?php 
        if ($show_comments == 'true') {
            ?>
                        <li><a href="#tab3" data-toggle="tab"><?php 
            echo __('Comments', THEMENAME);
            ?>
</a></li>
                    <?php 
        }
        ?>
                </ul>
                <div class="tab-content">
                    <?php 
        if ($show_popular_posts == 'true') {
            ?>
                        <div id="tab1" class="tab-pane active">
                            <?php 
            $popular_posts = new WP_Query('showposts=' . $posts . '&orderby=comment_count&order=DESC');
            if ($popular_posts->have_posts()) {
                ?>
                                <ul class="news-list cs-popular">
                                    <?php 
                while ($popular_posts->have_posts()) {
                    $popular_posts->the_post();
                    ?>
                                        <li>
                                            <div class="cs-meta table-cell">
                                                <?php 
                    if (has_post_thumbnail()) {
                        ?>
                                                <div class="image">
                                                   	<a class="post-featured-img" href="<?php 
                        the_permalink();
                        ?>
">
                                                       <?php 
                        the_post_thumbnail('thumbnail');
                        ?>
                                                   	</a>
                                                </div>
                                                <?php 
                    }
                    ?>
    			                                <div class="date">
                                                    <span><?php 
                    echo get_the_date('M jS');
                    ?>
</span>
                                                    <span><?php 
                    echo get_the_date('Y');
                    ?>
</span>
                                                </div>
                                            </div>

                                            <div class="cs-details table-cell">
                                                <h4><?php 
                    the_title();
                    ?>
</h4>
                                                <div class="description"><?php 
                    echo cshero_string_limit_words(strip_tags(get_the_excerpt()), 10) . "...";
                    ?>
</div>
                                                <div class="readmore">
                                                    <a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    echo __('Read More...', THEMENAME);
                    ?>
</a>
                                                </div>
                                            </div>
                                        </li>
                                    <?php 
                }
                ?>
                                </ul>
                            <?php 
            }
            ?>
                        </div>
                    <?php 
        }
        ?>
                    <?php 
        if ($show_recent_posts == 'true') {
            ?>
                        <div id="tab2" class="tab-pane">
                            <?php 
            $recent_posts = new WP_Query('showposts=' . $posts);
            if ($recent_posts->have_posts()) {
                ?>
                                <ul class="news-list cs-popular">
                                    <?php 
                while ($recent_posts->have_posts()) {
                    $recent_posts->the_post();
                    ?>
                                        <li>
                                            <div class="cs-meta table-cell">
                                                <?php 
                    if (has_post_thumbnail()) {
                        ?>
                                                <div class="image">
                                                   	<a class="post-featured-img" href="<?php 
                        the_permalink();
                        ?>
">
                                                       <?php 
                        the_post_thumbnail('thumbnail');
                        ?>
                                                   	</a>
                                                </div>
                                                <?php 
                    }
                    ?>
    			                                <div class="date">
    			                                	<span><?php 
                    echo get_the_date('M jS');
                    ?>
</span>
                                                    <span><?php 
                    echo get_the_date('Y');
                    ?>
</span>
                                                </div>
                                            </div>

                                            <div class="cs-details table-cell">
                                                <h4><?php 
                    the_title();
                    ?>
</h4>
                                                <div class="description"><?php 
                    echo cshero_string_limit_words(strip_tags(get_the_excerpt()), 10) . "...";
                    ?>
</div>
                                                <div class="readmore">
                                                    <a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    echo __('Read More...', THEMENAME);
                    ?>
</a>
                                                </div>
                                            </div>
                                        </li>
                                    <?php 
                }
                ?>
                                </ul>
                            <?php 
            }
            ?>
                        </div>
                    <?php 
        }
        ?>
                    <?php 
        if ($show_comments == 'true') {
            ?>
                        <div id="tab3" class="tab-pane">
                            <ul class="news-list sh-list-comment">
                                <?php 
            global $wpdb;
            $number = $instance['comments'];
            $recent_comments = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type, comment_author_url, SUBSTRING(comment_content,1,110) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT {$number}";
            $the_comments = $wpdb->get_results($recent_comments);
            foreach ($the_comments as $comment) {
                ?>
                                    <li>
                                        <div class="image table-cell">
                                            <a>
                                                <?php 
                echo get_avatar($comment->comment_author_email, '32');
                ?>
                                            </a>
                                        </div>
                                        <div class="post-holder table-cell">
                                            <p><?php 
                echo strip_tags($comment->comment_author);
                ?>
 says:</p>
                                            <div class="meta">
                                                <a class="comment-text-side" href="<?php 
                echo get_permalink($comment->ID);
                ?>
#comment-<?php 
                echo $comment->comment_ID;
                ?>
" title="<?php 
                echo strip_tags($comment->comment_author);
                ?>
 on <?php 
                echo $comment->post_title;
                ?>
"><?php 
                echo cshero_string_limit_words(strip_tags($comment->com_excerpt), 12);
                ?>
...</a>
                                            </div>
                                        </div>
                                    </li>
                                <?php 
            }
            ?>
                            </ul>
                        </div>
                    <?php 
        }
        ?>
                </div>
            </div>
        </div>
        <?php 
        echo $after_widget;
    }
コード例 #2
0
        ?>
"><i class=" fa fa-search"></i></a>
                        <div class="menuFoood-overlay"></div>
                    </div>
                </div>
            <?php 
    }
    ?>
            <div class="cs-menuFood-content" style="padding-left: <?php 
    echo $width_image;
    ?>
px">
                <div class="padding">
                    <?php 
    if ($excerpt_length != '') {
        echo cshero_string_limit_words(strip_tags(get_the_content()), $excerpt_length);
    } else {
        the_content();
    }
    ?>
                </div>
            </div><!-- .entry-content -->
            </div>
            <div class="cs-menuFood-footer table">
            <?php 
    if (get_post_meta(get_the_ID(), 'cs_menu_special', true) == 'yes') {
        ?>
                <div class="feature-icon table-cell">
                   <span><?php 
        _e('CHEF’S SPECIAL', THEMENAME);
        ?>
コード例 #3
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts', THEMENAME) : $instance['title'], $instance, $this->id_base);
        $show_date = $instance['show_date'];
        $number = (int) $instance['number'];
        $sticky = get_option('sticky_posts');
        $args = array('posts_per_page' => $number, 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => $sticky, 'orderby' => 'date', 'order' => 'DESC', 'paged' => 1);
        $wp_query = new WP_Query($args);
        $extra_class = !empty($instance['extra_class']) ? $instance['extra_class'] : "";
        // no 'class' attribute - add one with the value of width
        if (strpos($before_widget, 'class') === false) {
            $before_widget = str_replace('>', 'class="' . $extra_class . '"', $before_widget);
        } else {
            $before_widget = str_replace('class="', 'class="' . $extra_class . ' ', $before_widget);
        }
        echo $before_widget;
        ?>
        <div class="heading">
        <?php 
        echo $before_title . cshero_custom_title_widget($title) . $after_title;
        ?>
        </div>
        <?php 
        if ($wp_query->have_posts()) {
            ?>
                <div class="cs-recent-post">
                    <ul class="news-list cs-popular">
                        <?php 
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                ?>
                        <li>
                           <div class="cs-meta table-cell">
                               <?php 
                if (has_post_thumbnail()) {
                    ?>
                               <div class="image">
                                   <a class="post-featured-img" href="<?php 
                    the_permalink();
                    ?>
">
                                      <?php 
                    the_post_thumbnail('thumbnail');
                    ?>
                                   </a>
                                </div>
                                <?php 
                }
                ?>
                                <?php 
                if ($show_date) {
                    ?>
    			                <div class="date">
                                    <span><?php 
                    echo get_the_date('M jS');
                    ?>
</span>
                                    <span><?php 
                    echo get_the_date('Y');
                    ?>
</span>
                                </div>
                                <?php 
                }
                ?>
                             </div>
                             <div class="cs-details table-cell">
                                  <h4><?php 
                the_title();
                ?>
</h4>
                                  <div class="description"><?php 
                echo cshero_string_limit_words(strip_tags(get_the_excerpt()), 10) . "...";
                ?>
</div>
                                  <div class="readmore">
                                      <a href="<?php 
                the_permalink();
                ?>
"><?php 
                echo __('Read More...', THEMENAME);
                ?>
</a>
                                  </div>
                            </div>
                         </li>
                        <?php 
            }
            ?>
                    </ul>
                </div>
            <?php 
        } else {
            ?>
                <span class="notfound">No post found!</span>
            <?php 
        }
        echo $after_widget;
    }
コード例 #4
0
function cs_shortcode_next_event_render($params, $content = null)
{
    global $wpdb;
    extract(shortcode_atts(array('title' => '', 'image' => '', 'description' => '', 'class' => ''), $params));
    $date_sever = date_i18n('Y-m-d G:i:s');
    $gmt_offset = get_option('gmt_offset');
    //date_default_timezone_set("America/Los_Angeles");
    wp_enqueue_script('jquery-plugin', get_template_directory_uri() . "/framework/shortcodes/eventcountdown/js/jquery.plugin.min.js");
    wp_enqueue_script('jquery-countdown', get_template_directory_uri() . "/framework/shortcodes/eventcountdown/js/jquery.countdown.min.js");
    wp_enqueue_script('custom-countdown', get_template_directory_uri() . "/framework/shortcodes/eventcountdown/js/custom.countdown.js");
    $querys = array('posts_per_page' => 1, 'post_type' => 'event', 'post_status' => 'publish');
    add_filter('posts_join', 'cms_event_query_join');
    add_filter('posts_where', 'cms_event_query_where');
    add_filter('posts_orderby', 'cms_event_query_orderby');
    $the_query = new WP_Query($querys);
    remove_filter('posts_join', 'cms_event_query_join');
    remove_filter('posts_where', 'cms_event_query_where');
    remove_filter('posts_orderby', 'cms_event_query_orderby');
    if (isset($the_query) && $the_query->have_posts()) {
        ob_start();
        ?>
	<div class="cs-eventCount">
		<div class="cs-eventCount-header widget-block-header">
			<?php 
        if ($title) {
            ?>
				<h1 class="cs-title"><?php 
            echo esc_attr($title);
            ?>
</h1>
			<?php 
        }
        ?>
			<?php 
        if ($description) {
            ?>
				<p class="cs-desc"><?php 
            echo esc_attr($description);
            ?>
</p>
			<?php 
        }
        ?>
		</div>
		<?php 
        while ($the_query->have_posts()) {
            $the_query->the_post();
            $pageposts = $wpdb->get_row("SELECT e.event_start_date, e.event_start_time FROM {$wpdb->prefix}em_events e WHERE e.post_id = '" . get_the_ID() . "'");
            $utc_date = !empty($pageposts) ? date('Y,m,d,H,i,s', strtotime($pageposts->event_start_date . " " . $pageposts->event_start_time)) : null;
            ?>
			<div class="cs-eventCount-content">
				<?php 
            $image = wp_get_attachment_image_src($image, 'full');
            ?>
				<div class='cs-eventCount-introImg col-xs-12 col-sm-12 col-md-6 col-lg-6'><img alt="<?php 
            the_title();
            ?>
" src="<?php 
            echo esc_url($image[0]);
            ?>
"/></div>
				<div class="cs-eventCount-contentWrap col-xs-12 col-sm-12 col-md-6 col-lg-6">
					<h3 class="cs-eventCount-title"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h3>
					<div class="cs-eventCount-content-main"><?php 
            echo cshero_string_limit_words(strip_tags(get_the_content()), 20);
            ?>
...</div>
					<span id="event_countdown" class="" data-count="<?php 
            echo esc_attr($utc_date);
            ?>
" data-timezone="<?php 
            echo esc_attr($gmt_offset);
            ?>
" data-label="<?php 
            echo __('DAYS', THEMENAME) . ',' . __('HOURS', THEMENAME) . ',' . __('MINUTES', THEMENAME) . ',' . __('SECONDS', THEMENAME);
            ?>
"></span>
				</div>
			</div>
		<?php 
        }
        ?>
	</div>
	<?php 
    }
    return ob_get_clean();
}
コード例 #5
0
ファイル: introlist.php プロジェクト: daanbakker1995/vanteun
function cshero_intro_list_render($params, $content = null)
{
    global $post, $wp_query;
    extract(shortcode_atts(array('category' => '1', 'excerpt_length' => '', 'crop_big' => '', 'big_width' => '465', 'big_height' => '340', 'crop_mini' => '', 'mini_width' => '465', 'mini_height' => '170', 'orderby' => 'ID', 'order' => 'DESC'), $params));
    wp_enqueue_style('introlist', get_template_directory_uri() . '/framework/shortcodes/introlist/css/introlist.css', array(), '1.0.0');
    if (isset($category) && $category != '') {
        $cats = explode(',', $category);
        $category = array();
        foreach ((array) $cats as $cat) {
            $category[] = trim($cat);
        }
        $args = array('posts_per_page' => 4, 'tax_query' => array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $category)), 'orderby' => $orderby, 'order' => $order, 'post_type' => 'post', 'post_status' => 'publish');
    } else {
        $args = array('posts_per_page' => 4, 'orderby' => $orderby, 'order' => $order, 'post_type' => 'post', 'post_status' => 'publish');
    }
    $wp_query = new WP_Query($args);
    $i = 0;
    ob_start();
    ?>

    <div class="cs-introlist">
    <?php 
    while ($wp_query->have_posts()) {
        $wp_query->the_post();
        $i++;
        ?>

        <?php 
        if ($i == 1 || $i == 3) {
            ?>

        <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
        <?php 
        }
        ?>

            <?php 
        if ($i == 1 || $i == 4) {
            ?>

            <?php 
            $attachment_image = "";
            if (has_post_thumbnail()) {
                $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full', false);
                if ($crop_big) {
                    $attachment_image = mr_image_resize($image[0], $big_width, $big_height, true, 'c', false);
                } else {
                    $attachment_image = $image[0];
                }
            }
            ?>

            <div class="cs-introlist-big">
                <div class="cs-introlist-image">
                    <img alt="<?php 
            the_title();
            ?>
" src="<?php 
            echo esc_url($attachment_image);
            ?>
">
                    <div class="cs-introlist-description">
                        <?php 
            if ($excerpt_length != '') {
                echo cshero_string_limit_words(strip_tags(get_the_content()), (int) $excerpt_length);
            } else {
                echo strip_tags(get_the_content());
            }
            ?>

                    </div>
                    <div class="cs-introlist-title">
                        <h3><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h3>
                    </div>
                    <div class="cs-introlist-more"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            _e('More Info', THEMENAME);
            ?>
</a></div>
                    <a class="cs-introlist-overlay" href="<?php 
            the_permalink();
            ?>
"></a>
                </div>
            </div>
            <?php 
        }
        ?>

            <?php 
        if ($i == 2 || $i == 3) {
            ?>

            <?php 
            $attachment_image = "";
            if (has_post_thumbnail()) {
                $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full', false);
                if ($crop_mini) {
                    $attachment_image = mr_image_resize($image[0], $mini_width, $mini_height, true, 'c', false);
                } else {
                    $attachment_image = $image[0];
                }
            }
            ?>

            <div class="cs-introlist-mini">
                <div class="cs-introlist-image">
                    <img alt="<?php 
            the_title();
            ?>
" src="<?php 
            echo esc_url($attachment_image);
            ?>
">
                    <div class="cs-introlist-title">
                        <h3><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h3>
                    </div>
                    <div class="cs-introlist-more"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            _e('More Info', THEMENAME);
            ?>
</a></div>
                    <a class="cs-introlist-overlay" href="<?php 
            the_permalink();
            ?>
"></a>
                </div>
            </div>
            <?php 
        }
        ?>

        <?php 
        if ($i == 2 || $i == 4) {
            ?>

        </div>
        <?php 
        }
        ?>

    <?php 
    }
    ?>

    </div>
    <?php 
    wp_reset_query();
    wp_reset_postdata();
    return ob_get_clean();
}
コード例 #6
0
function cs_shortcode_next_event_render($params, $content = null)
{
    global $wpdb;
    extract(shortcode_atts(array('title' => '', 'image' => '', 'description' => '', 'class' => ''), $params));
    $date_sever = date_i18n('Y-m-d G:i:s');
    $gmt_offset = get_option('gmt_offset');
    //date_default_timezone_set("America/Los_Angeles");
    wp_enqueue_script('jquery-plugin', get_template_directory_uri() . "/framework/shortcodes/eventcountdown/js/jquery.plugin.min.js");
    wp_enqueue_script('jquery-countdown', get_template_directory_uri() . "/framework/shortcodes/eventcountdown/js/jquery.countdown.min.js");
    wp_enqueue_script('custom-countdown', get_template_directory_uri() . "/framework/shortcodes/eventcountdown/js/custom.countdown.js");
    $querystr = "\r\r\n\t    SELECT e.post_id, e.event_name, e.event_start_date, e.event_start_time, e.post_content\r\r\n\t    FROM {$wpdb->prefix}em_events e\r\r\n\t    WHERE e.event_status = '1'\r\r\n\t    AND TIMESTAMP(CONCAT(e.event_start_date,' ',e.event_start_time)) >= TIMESTAMP('{$date_sever}')\r\r\n\t    ORDER BY e.event_start_date ASC, e.event_start_time ASC\r\r\n \t";
    $pageposts = $wpdb->get_row($querystr);
    ob_start();
    ?>

	<div class="cs-eventCount">
		<div class="cs-eventCount-header widget-block-header">
			<?php 
    if ($title) {
        ?>

				<h1 class="cs-title"><?php 
        echo esc_attr($title);
        ?>
</h1>
			<?php 
    }
    ?>

			<?php 
    if ($description) {
        ?>

				<p class="cs-desc"><?php 
        echo esc_attr($description);
        ?>
</p>
			<?php 
    }
    ?>

		</div>
		<?php 
    if (count($pageposts) > 0) {
        ?>

			<?php 
        $utc_date = date('Y,m,d,H,i,s', strtotime($pageposts->event_start_date . " " . $pageposts->event_start_time));
        ?>

			<div class="cs-eventCount-content">
				<?php 
        $image = wp_get_attachment_image_src($image, 'full');
        ?>

				<div class='cs-eventCount-introImg col-xs-12 col-sm-12 col-md-6 col-lg-6'><img alt="<?php 
        echo esc_attr($pageposts->event_name);
        ?>
" src="<?php 
        echo esc_url($image[0]);
        ?>
"/></div>
				<div class="cs-eventCount-contentWrap col-xs-12 col-sm-12 col-md-6 col-lg-6">
					<h3 class="cs-eventCount-title"><a href="<?php 
        echo get_permalink($pageposts->post_id);
        ?>
"><?php 
        echo esc_attr($pageposts->event_name);
        ?>
</a></h3>
					<div class="cs-eventCount-content-main"><?php 
        echo cshero_string_limit_words(strip_tags($pageposts->post_content), 20);
        ?>
...</div>
					<span id="event_countdown" class="" data-count="<?php 
        echo esc_attr($utc_date);
        ?>
" data-timezone="<?php 
        echo esc_attr($gmt_offset);
        ?>
" data-label="<?php 
        echo __('DAYS', THEMENAME) . ',' . __('HOURS', THEMENAME) . ',' . __('MINUTES', THEMENAME) . ',' . __('SECONDS', THEMENAME);
        ?>
"></span>
				</div>
			</div>
		<?php 
    }
    ?>

	</div>
	<?php 
    return ob_get_clean();
}