コード例 #1
0
function build_portfolio_item($pageid, $cols, $is_carousel = false, $thumbnail_dims, $chars_count)
{
    $out = '';
    $cws_stored_meta = get_post_meta($pageid, 'cws-portfolio');
    if (!$is_carousel) {
        $cats = wp_get_post_terms($pageid, 'cws-portfolio-type');
        $cat_id = '';
        if (count($cats) > 0) {
            foreach ($cats as $cat) {
                $cat_id .= $cat->term_id;
            }
        }
    }
    $out .= '<div class="item"' . (!$is_carousel ? ' data-category="' . $cat_id . '"' : '') . '>';
    $video = isset($cws_stored_meta[0]['cws-portfolio-video']) ? esc_attr($cws_stored_meta[0]['cws-portfolio-video']) : '';
    $is_direct_url = isset($cws_stored_meta[0]['cws-portfolio-is-video-link']) ? true : false;
    $content = get_the_content();
    $image = cws_portfolio_get_image($content);
    $fancy_image = $image;
    $a_class = '';
    $url_target = '';
    if (empty($image)) {
        $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
        $fancy_image = $img[0];
        $image = bfi_thumb($img[0], $thumbnail_dims);
        //$image = $img[0];
    }
    $out .= '<div class="pic">';
    $out .= '<img src="' . $image . '" alt="">';
    $out .= '<div class="hover-effect"></div>';
    $out .= '<div class="links">';
    $out .= '<a' . ($is_direct_url ? ' href="' . (empty($video) ? get_the_permalink() : $video) . '" class="fa fa-link" target = "_blank"' : (!empty($video) ? ' href="' . $video . '" class="fa fa-magic fancy" data-fancybox-type="iframe"' : (!empty($image) ? ' href="' . $fancy_image . '" class="fancy fa fa-eye"' : ''))) . '></a>';
    $out .= '</div></div>';
    $out .= '<div class="portfolio_item_info">';
    $title = get_the_title();
    $link = !$is_direct_url ? get_the_permalink() : (empty($video) ? get_the_permalink() : $video);
    $out .= !empty($title) ? "<div class='name'><a href='{$link}'" . (!empty($video) && $is_direct_url ? " target = '_blank'" : "") . ">{$title}</a></div>" : "";
    $out .= !empty($cws_stored_meta[0]['cws-portfolio-short_desc']) ? $cws_stored_meta[0]['cws-portfolio-short_desc'] : cws_post_content_output($chars_count);
    $out .= '</div></div>';
    return $out;
}
コード例 #2
0
function cws_post_output($sb_block, $blogtype = "large", $pinterest_layout = "2", $post = null)
{
    $pid = $post ? $post->ID : get_the_id();
    if (get_the_title() && get_post_format() != "aside") {
        ?>
				<div class="widget-title">
				<?php 
        echo (!isset($post) ? "<a href='" . get_permalink($pid) . "'>" : "") . get_the_title() . (!isset($post) ? "</a>" : "");
        ?>
				</div>
			<?php 
    }
    if (get_post_type($pid) == 'post') {
        ?>
			<div class="date clearfix">
				<i class="fa fa-comment">
					<?php 
        $show_comments = cws_get_option('show_comments');
        $bIsCommentAllowed = is_page() ? isset($show_comments['pages']) : isset($show_comments['posts']);
        if ($bIsCommentAllowed) {
        } else {
        }
        ?>
					<a href="<?php 
        comments_link();
        ?>
">
					<span><?php 
        echo comments_number('0', '1', '%');
        ?>
</span>
					</a>
				</i>
				<?php 
        the_time(get_option('date_format'));
        ?>
			</div>
			<?php 
    }
    cws_output_media_part($blogtype, $pinterest_layout, $sb_block, $post);
    $content = "";
    if (null != $post) {
        $content .= apply_filters('the_content', get_the_content($post->ID));
    } else {
        $chars_count = cws_get_content_chars_count($blogtype, $pinterest_layout);
        $content .= cws_post_content_output($chars_count, $blogtype);
    }
    echo $content;
    if (get_post_type($pid) == 'post') {
        echo "<div class='cats'>" . __("Posted", THEME_SLUG);
        $categories = get_the_category($pid);
        $show_author = cws_get_option("blog_author");
        $tags = wp_get_post_tags($pid);
        if (!empty($categories) || $show_author || !empty($tags)) {
            if (!empty($categories)) {
                echo " " . __("in", THEME_SLUG) . " ";
                for ($i = 0; $i < count($categories); $i++) {
                    echo "<a href='" . get_category_link($categories[$i]->cat_ID) . "'>" . $categories[$i]->name . "</a>";
                    echo $i < count($categories) - 1 ? ", " : "";
                }
            }
            if ($show_author) {
                echo " " . __("by", THEME_SLUG) . " ";
                $author = get_the_author();
                echo !empty($author) ? $author : "";
            }
            if (!empty($tags)) {
                //echo "";
                echo get_the_tag_list(' | Tags: ', ', ');
                /*for ($i=0; $i<count($tags) ;$i++) {
                			echo "<a href='" . get_tag_link($tags[$i]->term_id) . "'>" . $tags[$i]->name . "</a>";
                			echo $i<count($tags)-1 ? ", " : "";
                		}*/
            }
        }
        echo $blogtype != 'pinterest' && !is_single() ? "<a href='" . get_permalink($pid) . "' class='more fa fa-long-arrow-right'></a>" : "";
        echo "</div>";
    }
}
コード例 #3
0
    function widget($args, $instance)
    {
        extract($args);
        extract($instance);
        $title = !empty($instance['title']) ? $instance['title'] : __('Latest Pictures', THEME_SLUG);
        $title = apply_filters('widget_title', $title, $instance, $this->id_base);
        $number = !empty($instance['number']) ? absint($instance['number']) : 4;
        // default value
        ob_start();
        echo $before_widget;
        /* ICON OUTPUT */
        $args = array("title_select" => $title_select, "title_fa" => $title_fa, "title_img" => $title_img);
        cws_widget_icon_rendering($args);
        /* ICON OUTPUT */
        $cat_name = !empty($category) ? get_term_by("id", $category, "cws-portfolio-type")->name : "";
        $query_args = array('post_type' => 'portfolio', 'cws-portfolio-type' => $cat_name, 'post_status' => 'published', 'posts_per_page' => -1);
        $items = new WP_Query($query_args);
        $carousel = $items->post_count > 1 ? true : false;
        ?>

		<div class="cws-widget-content <?php 
        echo isset($backlight) && $backlight == 'on' ? 'backlight' : '';
        ?>
">
			<div class='carousel_header clearfix'>
			<?php 
        echo $carousel ? "<div class='widget_carousel_nav'><i class='prev fa fa-angle-left'></i><i class='next fa fa-angle-right'></i><div class='clearfix'></div></div>" : "";
        ?>
			<?php 
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        ?>
			</div>
			<div class='photo_tour carousel_content'>
				<?php 
        echo $carousel ? "<section class='widget_carousel'>" : "";
        $counter = 0;
        if ($items->have_posts()) {
            $gallery_id = uniqid('cws-gallery-');
            while ($items->have_posts() && $counter < $number) {
                $items->the_post();
                $full = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_id()), 'full');
                $full_url = $full[0];
                if (!empty($full_url)) {
                    $cws_stored_meta = get_post_meta(get_the_id(), 'cws-portfolio');
                    $thumb_url = bfi_thumb($full_url, array('width' => 270, 'height' => 270, 'crop' => true));
                    $counter++;
                    ?>
								<div class='item'>
									<div class="pic">
										<?php 
                    echo "<img src='{$thumb_url}' alt /><div class='hover-effect'></div><div class='links'><a" . ($carousel ? " data-fancybox-group='{$gallery_id}'" : "") . " href='{$full_url}' class='fancy" . ($carousel ? " fancy_gallery" : "") . " fa fa-photo'></a></div>";
                    ?>
									</div>
									<div class='portfolio_item_info'>
										<?php 
                    $title = get_the_title();
                    $link = get_the_permalink();
                    echo !empty($title) ? "<div class='name'><a href='{$link}'>{$title}</a></div>" : "";
                    $short_desc = !empty($cws_stored_meta[0]['cws-portfolio-short_desc']) ? $cws_stored_meta[0]['cws-portfolio-short_desc'] : "";
                    echo !empty($short_desc) ? substr($short_desc, 0, 60) : cws_post_content_output(60);
                    ?>
									</div>
								</div>
							<?php 
                }
            }
        }
        echo $carousel ? "</section>" : "";
        ?>
			</div>
		</div>
		<?php 
        echo $after_widget;
        ob_end_flush();
    }
コード例 #4
0
        echo $blogtype ? 'news-' . $blogtype : '';
        ?>
 staff_results">
							<div class="grid clearfix">
								<?php 
        if ($r->have_posts()) {
            while ($r->have_posts()) {
                $r->the_post();
                $curr_post = $r->posts[$r->current_post];
                ?>
											<div class='item clearfix'>
												<?php 
                cws_output_media_part($blogtype, 2, $sb_block, $curr_post);
                $title = get_the_title();
                echo $title ? "<div class='widget-title'>" . $title . "</div>" : "";
                echo cws_post_content_output(500);
                $positions = wp_get_post_terms(get_the_ID(), 'cws-staff-position');
                echo "<div class='cats'>" . __("Positions: ", THEME_SLUG);
                for ($i = 0; $i < count($positions); $i++) {
                    echo $positions[$i]->name;
                    echo $i < count($positions) - 1 ? ", " : "";
                }
                echo "<a href=" . get_permalink() . " class='more fa fa-long-arrow-right'></a>";
                echo "</div>";
                ?>
											</div>
											<?php 
            }
        }
        ?>
							</div>