Пример #1
0
<?php

$link = get_permalink($post->ID);
$args = array('postid' => $post->ID, 'width' => 940, 'height' => 530, 'hide_href' => false, 'exclude_video' => false, 'imglink' => false, 'imgnocontainer' => true, 'resizer' => '940x529');
$image = get_obox_media($args);
global $post;
?>



<?php 
if ($image != "") {
    ?>
 

	<div class="post-image fitvid"> 

		 <?php 
    echo $image;
    ?>

    </div>

<?php 
}
?>



<ul class="double-cloumn clearfix">
Пример #2
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        global $woocommerce;
        $instance_defaults = array('excerpt_length' => 80, 'post_thumb' => 1);
        $instance_args = wp_parse_args($instance, $instance_defaults);
        extract($instance_args, EXTR_SKIP);
        if (isset($instance["title"])) {
            $title = esc_attr($instance["title"]);
        }
        if (isset($instance["title_link"])) {
            $title_link = esc_attr($instance["title_link"]);
        }
        // Setup the post filter if it's defined
        if (isset($postfilter) && isset($instance[$postfilter])) {
            $filterval = esc_attr($instance[$postfilter]);
        } else {
            $filterval = 0;
        }
        // Set the base query args
        if (isset($postfilter) && $postfilter != "" && $filterval != "0") {
            $args = array("post_type" => $posttype, "posts_per_page" => $post_count, "tax_query" => array(array("taxonomy" => $postfilter, "field" => "slug", "terms" => $filterval)));
        } else {
            $args = array("post_type" => $posttype, "posts_per_page" => $post_count);
        }
        $loop = new WP_Query($args);
        $count = 0;
        $numposts = 0;
        ?>

			<?php 
        if (isset($title)) {
            ?>

				<h4 class="widgettitle">
					<a href="<?php 
            if (isset($title_link)) {
                echo $title_link;
            }
            ?>
"><?php 
            echo $title;
            ?>
</a>
				</h4>
			<?php 
        }
        ?>

			<ul class="double-cloumn clearfix">
				<li id="left-column">	
					<ul class="blog-main-post-container clearfix">
						<?php 
        if ($loop->have_posts()) {
            while ($loop->have_posts()) {
                $loop->the_post();
                global $post;
                $args = array('postid' => $post->ID, 'width' => 550, 'height' => 309, 'hide_href' => false, 'exclude_video' => $post_thumb, 'imglink' => false, 'imgnocontainer' => true, 'resizer' => '550x309');
                $image = get_obox_media($args);
                $link = get_permalink($post->ID);
                ?>

							
                            <li class="post">		
							
								<?php 
                if ($image != "" && $post_thumb != "none") {
                    ?>
 
									<div class="post-image fitvid"> 
										<?php 
                    echo $image;
                    ?>

									</div>
								<?php 
                }
                ?>

                                
								<h5 class="date">
									<?php 
                if (get_option("ocmx_meta_date") != "false") {
                    echo date_i18n('d F Y', strtotime($post->post_date));
                }
                ?>
, <?php 
                _e("written by", "ocmx");
                ?>
 <?php 
                the_author_posts_link();
                ?>

								</h5>
                                
								<h2 class="post-title"><a href="<?php 
                echo $link;
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
								
								<div class="copy clearfix">
									<?php 
                if (isset($show_excerpts) && $show_excerpts != "false") {
                    the_excerpt();
                    ?>

										<p><a href="<?php 
                    echo $link;
                    ?>
" class="action-link"><?php 
                    _e("Continue Reading &rarr;", "ocmx");
                    ?>
</a></p>
									<?php 
                }
                ?>

								
								</div>    
							</li>   
							<?php 
            }
        } else {
            ocmx_no_posts();
            wp_reset_postdata();
        }
        ?>

					</ul>
				</li>
				<?php 
        get_sidebar();
        ?>

			</ul>

<?php 
    }
Пример #3
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        // Turn $args array into variables.
        extract($args);
        global $post;
        // Turn $instance array into variables
        if (class_exists('Woocommerce')) {
            global $woocommerce;
        }
        $instance_defaults = array('title' => '', 'display_limit' => '', 'auto_interval' => '', 'post_thumb' => true);
        $instance_args = wp_parse_args($instance, $instance_defaults);
        extract($instance_args, EXTR_SKIP);
        // Setup the post filter if it's defined
        if (isset($postfilter) && isset($instance[$postfilter])) {
            $filterval = esc_attr($instance[$postfilter]);
        } else {
            $filterval = 0;
        }
        // Set the base query args
        if (isset($posttype)) {
            $args = array("post_type" => $posttype, "posts_per_page" => $display_limit);
        }
        // Filter by the chosen taxonomy
        if (isset($postfilter) && $postfilter != "" && $filterval != "0") {
            $args['tax_query'] = array(array("taxonomy" => $postfilter, "field" => "slug", "terms" => $filterval));
        }
        // Set the post order
        if (isset($post_order_by)) {
            $args['order'] = $post_order;
            $args['orderby'] = $post_order_by;
        }
        $count = 0;
        $numposts = 0;
        $ocmx_posts = new WP_Query($args);
        ?>


	<div class="slider clearfix">

		<ul class="gallery-container">
			<?php 
        while ($ocmx_posts->have_posts()) {
            $ocmx_posts->the_post();
            global $product;
            $args = array('postid' => $post->ID, 'width' => 940, 'height' => 530, 'hide_href' => false, 'exclude_video' => $post_thumb, 'imglink' => false, 'imgnocontainer' => true, 'resizer' => '940x529');
            $image = get_obox_media($args);
            ?>


				<li>
					<?php 
            if (isset($image) && $image != "") {
                ?>

						<div class="post-image fitvid">
							 <?php 
                echo add_video_wmode_transparent($image);
                ?>

						</div>
					<?php 
            }
            ?>

					<?php 
            if (isset($posttype) && $posttype == "product") {
                ?>

						<div class="overlay">
							<h3><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
 - <?php 
                echo $product->get_price_html();
                ?>
</a></h3>
							<?php 
                the_excerpt();
                ?>
                  		
						</div>
					<?php 
            }
            ?>

				</li>
			<?php 
            $count++;
        }
        ?>

		</ul>

		<div class="slider-dots" <?php 
        if ($slider_dots != 1) {
            ?>
id="overlay"<?php 
        }
        ?>
>
			<?php 
        for ($i = 0; $i < $count; $i++) {
            ?>

				<a href="#" rel="<?php 
            echo $i - 1;
            ?>
" class="dot <?php 
            if ($i == 0) {
                ?>
dot-selected<?php 
            }
            ?>
"><?php 
            echo $i;
            ?>
</a>
			<?php 
        }
        ?>

		</div>

		<?php 
        $count = 1;
        ?>


		<div id="slider-number-<?php 
        echo $use_category;
        ?>
" class="no_display">0</div>
		<div id="slider-auto-<?php 
        echo $use_category;
        ?>
" class="no_display"><?php 
        echo $auto_interval;
        ?>
</div>
	</div>

<?php 
    }
Пример #4
0
function get_obox_image($width = 590, $height = '', $href_class = 'thumbnail', $wrap = '', $wrap_class = '', $hide_href = false, $exclude_video = false, $zc = 1, $imglink = false, $imgnocontainer = false, $resizer = '')
{
    global $post, $blog_id;
    $args = array('postid' => $post->ID, 'width' => $width, 'height' => $height, 'href_class' => $href_class, 'wrap' => $wrap, 'wrap_class' => $wrap_class, 'hide_href' => $hide_href, 'exclude_video' => $exclude_video, 'zc' => $zc, 'imglink' => $imglink, 'imgnocontainer' => $imgnocontainer, 'resizer' => $resizer);
    return get_obox_media($args);
}
Пример #5
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        // Turn $instance array into variables
        if (class_exists('Woocommerce')) {
            global $woocommerce;
        }
        ?>

  
	 <!--Begin Column One -->     
	<ul class="two-column">
	
	<?php 
        for ($i = 1; $i < 3; $i++) {
            // Setup variables for this column
            if (isset($instance["title_" . $i])) {
                $title = $instance["title_" . $i];
            }
            if (isset($instance['post_count_' . $i])) {
                $post_count = $instance['post_count_' . $i];
            }
            if (isset($instance['show_images_' . $i])) {
                $show_images = $instance['show_images_' . $i];
            }
            if (isset($instance['show_excerpts_' . $i])) {
                $show_excerpts = $instance['show_excerpts_' . $i];
            }
            if (isset($instance['show_dates_' . $i])) {
                $show_dates = $instance['show_dates_' . $i];
            }
            if (isset($instance['post_category_' . $i])) {
                $post_category = $instance['post_category_' . $i];
            }
            $posttype = $instance["posttype_" . $i];
            $postfilter = $instance["postfilter_" . $i];
            $filtername = $postfilter . "_" . $i;
            $filterval = $instance[$filtername];
            if (isset($postfilter) && $postfilter != "" && $filterval != "0") {
                $args = array("post_type" => $posttype, "posts_per_page" => $post_count, "tax_query" => array(array("taxonomy" => $postfilter, "field" => "slug", "terms" => $filterval)));
            } else {
                $args = array("post_type" => $posttype, "posts_per_page" => $post_count);
            }
            //Set the post Aguments and Query accordingly
            $count = 0;
            $numposts = 0;
            $left_posts = new WP_Query($args);
            ?>

			
				<li class="column">
					<h4 class="section-title"><?php 
            if (isset($title)) {
                echo $title;
            }
            ?>
</h4>
					<ul>
						<?php 
            while ($left_posts->have_posts()) {
                $left_posts->the_post();
                global $post, $product;
                $link = get_permalink($post->ID);
                $args = array('postid' => $post->ID, 'width' => 460, 'hide_href' => false, 'exclude_video' => true, 'imglink' => false, 'imgnocontainer' => true, 'resizer' => '460');
                $image = get_obox_media($args);
                if (isset($show_images) && $show_images != "on" || $image == "") {
                    $maxlen = 120;
                } else {
                    $maxlen = 119;
                }
                ?>

							<li>				
								 <?php 
                if (isset($show_images) && $show_images == "on" && $image != "") {
                    ?>
 
									<!--Show the oEmbed Thumbnail if checked in Theme Options -->        			
									<div class="post-image fitvid">
										<?php 
                    echo $image;
                    ?>

									</div>
								<?php 
                } else {
                    $image = $woocommerce->plugin_url() . '/assets/images/placeholder.png';
                    ?>

									<div class="post-image fitvid">
										<img src="<?php 
                    echo $image;
                    ?>
" alt="<?php 
                    the_title();
                    ?>
" width="460px" height="120px" />
									</div>
								<?php 
                }
                ?>

								<!--Show Date -->
								<?php 
                if ($posttype != "product" && isset($show_dates) && $show_dates == "on") {
                    ?>

									<h5 class="date"><?php 
                    echo the_time(get_option('date_format'));
                    ?>
</h5>
								<?php 
                }
                ?>

								<!--Show the Title -->
								<h2 class="post-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                if ($posttype == "product") {
                    echo " - " . $product->get_price_html();
                }
                ?>
</a></h2>
								<!--Show Excerpt -->
								<?php 
                if (isset($show_excerpts) && $show_excerpts == "on") {
                    if ($post->post_excerpt != "") {
                        echo "<p>" . substr(strip_tags($post->post_excerpt), 0, $maxlen) . "...</p>";
                    } else {
                        the_excerpt("");
                    }
                }
                ?>

								<?php 
                if (isset($show_continue) && $show_continue == "on") {
                    if ($posttype == "product") {
                        do_action('woocommerce_after_shop_loop_item');
                    }
                }
                ?>

							</li>				
						<?php 
            }
            ?>

					</ul>
				</li>
			<?php 
        }
        ?>

		</ul>
	<?php 
    }
Пример #6
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        // Turn $instance array into variables
        if (class_exists('Woocommerce')) {
            global $woocommerce;
        }
        $instance_defaults = array('title' => '', 'title_link' => '', 'post_count' => '', 'show_images' => true, 'post_thumb' => true, 'show_dates' => false, 'show_excerpts' => false);
        $instance_args = wp_parse_args($instance, $instance_defaults);
        extract($instance_args, EXTR_SKIP);
        // Setup the post filter if it's defined
        if (isset($postfilter) && isset($instance[$postfilter])) {
            $filterval = esc_attr($instance[$postfilter]);
        } else {
            $filterval = 0;
        }
        // Set the base query args
        $args = array("post_type" => $posttype, "posts_per_page" => $post_count);
        // Filter by the chosen taxonomy
        if (isset($postfilter) && $postfilter != "" && $filterval != "0") {
            $args['tax_query'] = array(array("taxonomy" => $postfilter, "field" => "slug", "terms" => $filterval));
        }
        // Main Post Query
        $get_posts = new WP_Query($args);
        ?>
 
		
		
			<?php 
        if (isset($title)) {
            ?>

				<h4 class="widgettitle">
					<a href="<?php 
            if (isset($title_link)) {
                echo $title_link;
            }
            ?>
"><?php 
            echo $title;
            ?>
</a>
				</h4>
			<?php 
        }
        ?>

		<ul class="single-column">
			<?php 
        while ($get_posts->have_posts()) {
            $get_posts->the_post();
            global $post;
            $link = get_permalink($post->ID);
            $args = array('postid' => $post->ID, 'width' => 940, 'height' => 529, 'hide_href' => false, 'imglink' => false, 'exclude_video' => $post_thumb, 'imgnocontainer' => true, 'resizer' => '940x529');
            $image = get_obox_media($args);
            if ($show_images != "on" || $image == "") {
                $maxlen = 90;
            } else {
                $maxlen = 75;
            }
            ?>

				<li class="column">				
					<?php 
            if ($show_images != false && $image != "") {
                ?>

					<div class="post-image fitvid">
						<?php 
                echo $image;
                ?>

					</div>
					<?php 
            }
            ?>

					<?php 
            if ($show_dates != false) {
                ?>
<h5 class="date"><?php 
                echo date('d M Y', strtotime($post->post_date));
                ?>
</h5><?php 
            }
            ?>

						<h2 class="post-title"><a href="<?php 
            echo $link;
            ?>
"><?php 
            the_title();
            ?>
</a></h2>
				   
					<?php 
            if ($show_excerpts != false) {
                if ($post->post_excerpt != "") {
                    echo "<p>" . substr(strip_tags($post->post_excerpt), 0, $maxlen) . "...</p>";
                } else {
                    the_content("");
                }
            }
            ?>

				</li>				
			<?php 
        }
        ?>

		</ul>
<?php 
    }