function event_custom_columns($column)
{
    global $post;
    switch ($column) {
        case 'event_thumb':
            if (has_post_thumbnail($post->ID)) {
                the_post_thumbnail('square-menu-thumbnail');
            } else {
                _e('No Image', 'framework');
            }
            break;
        case 'event_dates':
            $startd = get_post_meta($post->ID, 'event_startdate', true);
            $endd = get_post_meta($post->ID, 'event_enddate', true);
            $date_format = get_option('date_format');
            $startdate = date($date_format, $startd);
            $enddate = date($date_format, $endd);
            echo $startdate . '<br/><strong><em>To</em></strong><br/>' . $enddate;
            break;
        case 'event_times':
            $startt = get_post_meta($post->ID, 'event_startdate', true);
            $endt = get_post_meta($post->ID, 'event_enddate', true);
            $time_format = get_option('time_format');
            $starttime = date($time_format, $startt);
            $endtime = date($time_format, $endt);
            echo $starttime . '<br/><strong><em>To</em></strong><br/>' . $endtime;
            break;
    }
}
Example #2
0
function manage_portfolio_columns($column)
{
    global $post;
    if ($post->post_type == "portfolio") {
        switch ($column) {
            case "description":
                the_excerpt();
                break;
            case "portfolio_categories":
                $terms = get_the_terms($post->ID, 'portfolio_category');
                if (!empty($terms)) {
                    foreach ($terms as $t) {
                        $output[] = "<a href='edit.php?post_type=portfolio&portfolio_tag={$t->slug}'> " . esc_html(sanitize_term_field('name', $t->name, $t->term_id, 'portfolio_tag', 'display')) . "</a>";
                    }
                    $output = implode(', ', $output);
                } else {
                    $t = get_taxonomy('portfolio_category');
                    $output = "No {$t->label}";
                }
                echo $output;
                break;
            case 'thumbnail':
                echo the_post_thumbnail('thumbnail');
                break;
        }
    }
}
    function widget($args, $instance)
    {
        extract($args);
        @($title = $instance['title'] ? $instance['title'] : '最热文章');
        @($num = $instance['num'] ? $instance['num'] : 5);
        echo $before_widget;
        ?>
      <div class="panel panel-zan hidden-xs">
        <div class="panel-heading"><?php 
        echo $title;
        ?>
</div>
        <div class="panel-body">
          <ul class="list-group">
            <?php 
        // 设置全局变量,实现post整体赋值
        global $post;
        $posts = zan_get_hotest_posts($num);
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
              <li class="zan-list clearfix">
                <figure class="thumbnail zan-thumb">
                  <?php 
            the_post_thumbnail(array(75, 75));
            ?>
                </figure>
                <a href="<?php 
            the_permalink();
            ?>
">
                 <h5><?php 
            the_title();
            ?>
</h5>
                </a>
                <div class="sidebar-info">
                  <span><i class="fa fa-calendar"></i> <?php 
            the_time('m月j日, Y');
            ?>
</span>
                  <span><i class="fa fa-comment"></i> <a href="<?php 
            the_permalink();
            ?>
#comments"><?php 
            comments_number('0', '1', '%');
            ?>
</a></span>
                </div>
              </li>
            <?php 
        }
        wp_reset_postdata();
        ?>
          </ul>
        </div>
      </div>
    <?php 
        echo $after_widget;
    }
    /**
     * Display an optional post thumbnail.
     *
     * Wraps the post thumbnail in an anchor element on index views, or a div
     * element when on single views.
     *
     * @since Twenty Fifteen 1.0
     */
    function launchpad_post_thumbnail()
    {
        if (post_password_required() || is_attachment() || !has_post_thumbnail()) {
            return;
        }
        if (is_singular()) {
            ?>

            <div class="post-thumbnail">
                <?php 
            the_post_thumbnail();
            ?>
            </div><!-- .post-thumbnail -->

        <?php 
        } else {
            ?>

            <a class="post-thumbnail" href="<?php 
            the_permalink();
            ?>
" aria-hidden="true">
                <?php 
            the_post_thumbnail('post-thumbnail', array('alt' => get_the_title()));
            ?>
            </a>

        <?php 
        }
        // End is_singular()
    }
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $number = $instance['number'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
		<div class="recent-works-items clearfix">
		<?php 
        $args = array('post_type' => 'evolve_portfolio', 'posts_per_page' => $number, 'has_password' => false);
        $portfolio = new WP_Query($args);
        if ($portfolio->have_posts()) {
            ?>
		<?php 
            while ($portfolio->have_posts()) {
                $portfolio->the_post();
                ?>
		<?php 
                if (has_post_thumbnail()) {
                    ?>
		<?php 
                    $link_target = "";
                    $url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
                    if (!empty($url_check)) {
                        $new_permalink = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
                        if (get_post_meta(get_the_ID(), 'pyre_link_icon_target', true) == "yes") {
                            $link_target = ' target="_blank"';
                        }
                    } else {
                        $new_permalink = get_permalink();
                    }
                    ?>
		<a href="<?php 
                    echo $new_permalink;
                    ?>
"<?php 
                    echo $link_target;
                    ?>
 title="<?php 
                    the_title();
                    ?>
">
			<?php 
                    the_post_thumbnail('recent-works-thumbnail');
                    ?>
		</a>
		<?php 
                }
            }
        }
        wp_reset_query();
        ?>
		</div>

		<?php 
        echo $after_widget;
    }
function show_faq($atts)
{
    ob_start();
    $secondary_query = new WP_Query(array('post_type' => 'questions', 'posts_per_page' => $atts[limit], 'tax_query' => array(array('taxonomy' => 'faq', 'field' => 'slug', 'terms' => $atts[category], 'operator' => 'IN'))));
    if ($secondary_query->have_posts()) {
        while ($secondary_query->have_posts()) {
            $secondary_query->the_post();
            echo '
								<div class="row">
									<div class="col-lg-8 col-lg-offset-2 centered">
							';
            the_post();
            the_post_thumbnail('thumbnail');
            the_title('<h1>', '</h1>');
            the_content();
            echo '
									</div>
								</div>
							';
        }
        // end while
    }
    // end if
    wp_reset_postdata();
    return ob_get_clean();
}
function vl_featured_post_image()
{
    $post_video = get_the_post_video_url($post_id);
    // $post_video = https://vimeo.com/example
    if (strpos($post_video, 'vimeo.com') !== FALSE) {
        $x = explode('/', $post_video);
        // $x = ['https:', 'vimeo.com', 'example']
        $video_id = array_pop($x);
        // $video_id = 'example'
        $player_url = '//player.vimeo.com/video/' . $video_id . '?autoplay=1&color=FFF';
        // $player_url = '//player.vimeo.com/video/example'
    }
    echo '<div class="entry">';
    echo '<a class="video-thumbnail" href="';
    echo $player_url;
    echo '" data-featherlight="iframe">';
    echo '<div class="entry-thumbnail">';
    the_post_thumbnail('large');
    //you can use medium, large or a custom size
    echo '<div class="play-button"></div>';
    echo '</div>';
    echo '</a>';
    // echo get_the_post_video( $post_id );
    // echo '<iframe class="lightbox" src="' . get_the_post_video_url( $post_id ) . '" id="';
    // echo get_the_ID();
    // echo '" style="border:none;" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>';
    // echo '</div>';
}
function gallery_custom_columns($column)
{
    global $post;
    switch ($column) {
        case 'gallery-thumb':
            if (has_post_thumbnail($post->ID)) {
                ?>
					<a href="<?php 
                the_permalink();
                ?>
" target="_blank">
						<?php 
                the_post_thumbnail('square-menu-thumbnail');
                ?>
					</a>
					<?php 
            } else {
                _e('No Thumbnail', 'framework');
            }
            break;
        case 'type':
            echo get_the_term_list($post->ID, 'gallery-item-type', '', ', ', '');
            break;
    }
}
	function widget($args, $instance) {
		extract($args);
		$title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance );

		$number = $instance['number'];
		
		echo $before_widget;

		if($title) {
			echo $before_title . $title . $after_title;
		}
		?>
		<div class="recent-works-items clearfix">
		<?php
		$args = array(
			'post_type' => 'portfolio',
			'posts_per_page' => $number
		);
		$portfolio = new WP_Query($args);
		if($portfolio->have_posts()):
		?>
		<?php while($portfolio->have_posts()): $portfolio->the_post(); ?>
		<div class="portfolio-widget-item">
            <?php if (has_post_thumbnail()) { ?>
            	<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="portfolio-image"><?php the_post_thumbnail( 'mini' ); ?></a>
            <?php } ?>
       </div>
		<?php endwhile; endif; ?>
		</div>

		<?php echo $after_widget;
	}
Example #10
0
    /**
     * Add Shortcode
     * @param $atts
     */
    public function FeedShortcode($atts)
    {
        // Attributes
        extract(shortcode_atts(array('number' => '4', 'sort' => 'date_listed'), $atts));
        $args = array('posts_per_page' => $number, 'post_type' => 'property', 'orderby' => 'meta_value', 'meta_key' => 'wptrebs_last_updated_text');
        $query = new WP_Query($args);
        if ($query->have_posts()) {
            echo '<ul class="wptrebs_feed">';
            while ($query->have_posts()) {
                $query->the_post();
                ?>
                <li class="wptrebs_feed_item">
                    <div class="price"><span>$</span><?php 
                echo number_format(get_post_meta(get_the_ID(), 'wptrebs_price', true));
                ?>
</div>
                    <a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_post_thumbnail('wptrebs_feed_img');
                ?>
</a>
                </li>
                <?php 
            }
            // end while
            echo '</ul>';
            echo '<div class="wptrebs_clear"></div>';
        }
        // end if
    }
 function ff_the_post_thumbnail()
 {
     // See /templates/onePage/blocks/blog-featured-area/blog-featured-area.php
     // And maybe /templates/helpers/class.ff_Featured_Area.php
     // And maybe /templates/helpers/func.ff_Gallery.php
     the_post_thumbnail();
 }
Example #12
0
function oe_main_slider($numbers = -1)
{
    global $post;
    $query = new WP_Query(array('post_type' => 'slider', 'posts_per_page' => $numbers));
    $imgArray = array();
    if ($query->have_posts()) {
        echo '<div id="header_slider" class="owl-carousel owl-theme">';
        while ($query->have_posts()) {
            $query->the_post();
            $slide_color = get_post_meta($post->ID, 'oe_slider_bg', true);
            ?>
        <div class="item slider-info" style="background-color:<?php 
            echo $slide_color;
            ?>
;">
            <div class="text-slider">
                <?php 
            the_content();
            echo '<a href="#" id="scroll_to"><span class="scroll-down"><span class="img-scroll-down"></span></span>' . __('see what we can do for you.', 'oneengine') . '</a>';
            ?>
            </div>
            <?php 
            the_post_thumbnail('full');
            ?>
        </div>
        
    <?php 
        }
        echo '</div>';
    }
    wp_reset_query();
}
    /**
     * front-end display of the widget
     * 
     * @param  $args		widget arguments
     * @param  $instance	saved values from database
     */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $page_id = apply_filters('page_thumbani_page_id', $instance['page_id']);
        $thumbnail_size = apply_filters('page_thumbani_thumbnail_size', $instance['thumbnail_size']);
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        $wp_query = new WP_Query(array('page_id' => $page_id));
        if ($wp_query->have_posts()) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                ?>

				<div class="text-center page-thumbnail-widget--content circle-hover">
				    <?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail($thumbnail_size, array('class' => 'img-center img-circle img-responsive'));
                }
                ?>
				</div>
			    <?php 
                the_title('<div class="row"><div class="col-md-10 col-md-offset-1 text-center"><h3 class="page-thumbnail-title"><a href="' . get_the_permalink() . '">', '</a></h3></div></div>');
                ?>

			<?php 
            }
        }
        wp_reset_query();
        echo $after_widget;
    }
 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     $instance = wp_parse_args($instance, array('title' => '', 'post_type' => 'micro-projet'));
     echo $args['before_widget'];
     if ($instance['title']) {
         /** This filter is documented in core/src/wp-includes/default-widgets.php */
         echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
     }
     // Show last micro project
     $micro_project_query_args = array('post_type' => $instance['post_type'], 'posts_per_page' => 5);
     if (is_singular()) {
         $micro_project_query_args['post__not_in'] = array(get_the_ID());
     }
     $micro_project_query = new WP_Query($micro_project_query_args);
     if ($micro_project_query->have_posts()) {
         echo '<ul>';
         while ($micro_project_query->have_posts()) {
             $micro_project_query->the_post();
             echo '<li>';
             echo '<a href="' . get_the_permalink() . '">';
             the_post_thumbnail('large');
             the_title('<h3>', '</h3>');
             echo '</a>';
             echo '</li>';
         }
         echo '</ul>';
         wp_reset_postdata();
     }
     echo $args['after_widget'];
 }
Example #15
0
function manage_product_columns($column_name, $product_id)
{
    $price_value = product_price($product_id);
    switch ($column_name) {
        case 'id':
            echo $product_id;
            break;
        case 'shortcode':
            echo '[show_products product="' . $product_id . '"]';
            break;
        case 'price':
            if ($price_value != '') {
                echo price_format($price_value);
            }
            break;
        case 'image':
            echo the_post_thumbnail(array(40, 40));
            break;
        case 'product_cat':
            echo get_the_term_list($product_id, 'al_product-cat', '', ', ', '');
            break;
        default:
            break;
    }
}
Example #16
0
function my_search()
{
    $query_string = $_GET['q'];
    $s = new WP_Query(array('s' => $query_string));
    echo '<ul>';
    while ($s->have_posts()) {
        $s->the_post();
        ?>

		<li>
			<a href="<?php 
        echo get_permalink($post->ID);
        ?>
">
				<?php 
        the_post_thumbnail();
        ?>
				<h4><?php 
        the_title();
        ?>
</h4>
			</a>
		</li>

	<?php 
    }
    echo '</ul>';
    wp_die();
}
Example #17
0
        /**
         * Display custom column.
         *
         * @since   1.0.0
         */
        public function display($column_name)
        {
            global $post;
            switch ($column_name) {
                case 'thumb':
                    if (has_post_thumbnail($post->ID)) {
                        ?>
	            	<?php 
                        the_post_thumbnail(array(130, 130));
                        ?>
	            <?php 
                    } else {
                        echo "—";
                    }
                    break;
                case 'url':
                    $url = get_post_meta($post->ID, 'vr_partner_url', true);
                    if (!empty($url)) {
                        echo $url;
                    } else {
                        echo "—";
                    }
                    break;
                default:
                    break;
            }
            // Switch ended.
        }
Example #18
0
	/** @see WP_Widget::widget */
	function widget($args, $instance) {
		$cache = wp_cache_get('widget_recent_products', 'widget');

		if ( !is_array($cache) ) $cache = array();

		if ( isset($cache[$args['widget_id']]) ) {
			echo $cache[$args['widget_id']];
			return;
		}

		ob_start();
		extract($args);
		
		$title = apply_filters('widget_title', empty($instance['title']) ? __('New Products', 'jigoshop') : $instance['title'], $instance, $this->id_base);
		if ( !$number = (int) $instance['number'] )
			$number = 10;
		else if ( $number < 1 )
			$number = 1;
		else if ( $number > 15 )
			$number = 15;

    $show_variations = $instance['show_variations'] ? '1' : '0';

    $args = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'post_type' => 'product');

    if($show_variations=='0'){
      $args['meta_query'] = array(
			  array(
				  'key' => 'visibility',
				  'value' => array('catalog', 'visible'),
				  'compare' => 'IN'
			  )
		  );
		  $args['parent'] = '0';
    }

		$r = new WP_Query($args);
		
		if ($r->have_posts()) :
?>
		<?php echo $before_widget; ?>
		<?php if ( $title ) echo $before_title . $title . $after_title; ?>
		<ul class="product_list_widget">
		<?php  while ($r->have_posts()) : $r->the_post(); $_product = &new jigoshop_product(get_the_ID()); ?>
		<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>">
			<?php if (has_post_thumbnail()) the_post_thumbnail('shop_tiny'); else echo '<img src="'.jigoshop::plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.jigoshop::get_var('shop_tiny_w').'px" height="'.jigoshop::get_var('shop_tiny_h').'px" />'; ?>
			<?php if ( get_the_title() ) the_title(); else the_ID(); ?>
		</a> <?php echo $_product->get_price_html(); ?></li>
		<?php endwhile; ?>
		</ul>
		<?php echo $after_widget; ?>
<?php
		// Reset the global $the_post as this query will have stomped on it
		//wp_reset_postdata();

		endif;

		if (isset($args['widget_id']) && isset($cache[$args['widget_id']])) $cache[$args['widget_id']] = ob_get_flush();
		wp_cache_set('widget_recent_products', $cache, 'widget');
	}
Example #19
0
    /**
     * Display the post thumbnail
     *
     * @return void
     */
    function base_post_thumbnail($postid)
    {
        if (post_password_required() || !has_post_thumbnail()) {
            return;
        }
        $format = get_post_format();
        if ($format == 'link') {
            $link_to = get_post_meta($postid, '_zilla_link_url', true);
        } else {
            $link_to = get_the_permalink($postid);
        }
        ?>

	<div class="entry-thumbnail">
	<?php 
        if (is_singular()) {
            the_post_thumbnail('full');
        } else {
            ?>
		<a href="<?php 
            echo esc_url($link_to);
            ?>
">
			<?php 
            the_post_thumbnail('blog-thumb');
            ?>
		</a>
	<?php 
        }
        ?>
	</div>

<?php 
    }
    /**
     * Display the post thumbnail
     *
     * @return void
     */
    function hanna_post_thumbnail($postid)
    {
        if (post_password_required() || !has_post_thumbnail()) {
            return;
        }
        $theme_options = get_theme_mod('zilla_theme_options');
        $format = get_post_format();
        if ($format == 'link') {
            $link_to = get_post_meta($postid, '_zilla_link_url', true);
        } else {
            $link_to = get_the_permalink($postid);
        }
        ?>

	<div class="entry-thumbnail">
	<?php 
        if (is_singular() || is_layout_standard()) {
            the_post_thumbnail('full');
        } else {
            ?>
		<a href="<?php 
            echo esc_url($link_to);
            ?>
">
			<?php 
            the_post_thumbnail();
            ?>
		</a>
	<?php 
        }
        ?>
	</div>

<?php 
    }
Example #21
0
function manage_artists_columns($name)
{
    global $wpdb, $wp_query, $post;
    switch ($name) {
        case 'genres':
            echo get_post_meta(get_the_ID(), 'artist_genres', TRUE);
            break;
        case 'artist_id':
            echo get_the_ID();
            break;
        case 'artist_cat':
            $terms = get_the_terms($post->ID, 'artist_cat');
            //If the terms array contains items... (dupe of core)
            if (!empty($terms)) {
                //Loop through terms
                foreach ($terms as $term) {
                    //Add tax name & link to an array
                    $post_terms[] = esc_html(sanitize_term_field('name', $term->name, $term->term_id, '', 'edit'));
                }
                //Spit out the array as CSV
                echo implode(', ', $post_terms);
            } else {
                //Text to show if no terms attached for post & tax
                echo '<em>No terms</em>';
            }
            break;
        case 'thumbnail':
            echo the_post_thumbnail(array(100, 100));
            break;
    }
}
function photograph_custom_columns($column)
{
    global $post;
    switch ($column) {
        case "photograph-categories":
            echo get_the_term_list($post->ID, 'photograph-categories', '', ', ', '');
            break;
        case "likes":
            if (function_exists('get_like')) {
                echo get_like($post - ID);
            }
            break;
        case "photo":
            if (has_post_thumbnail()) {
                the_post_thumbnail(array(75, 75));
            }
            break;
        case "feature":
            $url = wp_nonce_url(admin_url('admin-ajax.php?action=photograph-feature&id=' . $post->ID), 'photograph-feature');
            if (get_post_meta($post->ID, 'colabs_feature_photograph', true) == 'true') {
                $icon = '<img src="' . get_template_directory_uri() . '/images/on.png" />';
            } else {
                $icon = '<img src="' . get_template_directory_uri() . '/images/off.png" />';
            }
            echo '<a href="' . $url . '">' . $icon . '</a>';
            break;
    }
}
Example #23
0
function family_banner()
{
    ?>
	<div class="banner">
		<div class="wrap">
			<?php 
    if (is_front_page()) {
        family_get_header_image();
    } elseif (!is_front_page() && get_theme_mod('family_header_home')) {
        echo '';
    } else {
        // get title
        $id = get_option('page_for_posts');
        if ('posts' == get_option('show_on_front') && (is_day() || is_month() || is_year() || is_tag() || is_category() || is_singular('post') || is_home())) {
            family_get_header_image();
        } elseif (is_home() || is_singular('post')) {
            if (has_post_thumbnail($id)) {
                echo get_the_post_thumbnail($id, 'full');
            } else {
                family_get_header_image();
            }
        } elseif (has_post_thumbnail() && is_singular('page')) {
            the_post_thumbnail();
        } else {
            family_get_header_image();
        }
    }
    ?>
		</div><!-- .wrap -->
  	</div><!-- .banner -->
<?php 
}
function vntd_portfolio_columns_content($column, $post_id)
{
    global $post;
    switch ($column) {
        /* If displaying the 'duration' column. */
        case 'category':
            $taxonomy = "project-type";
            $post_type = get_post_type($post_id);
            $terms = get_the_terms($post_id, $taxonomy);
            if (!empty($terms)) {
                foreach ($terms as $term) {
                    $post_terms[] = "<a href='edit.php?post_type={$post_type}&{$taxonomy}={$term->slug}'> " . esc_html(sanitize_term_field('name', $term->name, $term->term_id, $taxonomy, 'edit')) . "</a>";
                }
                echo join(', ', $post_terms);
            } else {
                echo '<i>No categories.</i>';
            }
            break;
            /* If displaying the 'genre' column. */
        /* If displaying the 'genre' column. */
        case 'thumbnail':
            the_post_thumbnail('thumbnail', array('class' => 'column-img'));
            break;
            /* Just break out of the switch statement for everything else. */
        /* Just break out of the switch statement for everything else. */
        default:
            break;
    }
}
Example #25
0
function lifestyle_banner()
{
    ?>
	<div class="banner">
		<div class="wrap">
			<?php 
    if (is_front_page()) {
        lifestyle_get_home_banner();
    } elseif (!is_front_page() && get_theme_mod('lifestyle_header_home')) {
        echo '';
    } else {
        // get title
        $id = get_option('page_for_posts');
        if (is_home() || is_singular('post')) {
            if (has_post_thumbnail($id)) {
                echo get_the_post_thumbnail($id, 'full');
            }
        } elseif (has_post_thumbnail() && is_singular('page')) {
            the_post_thumbnail();
        }
    }
    ?>
		</div><!-- .wrap -->
  	</div><!-- .banner -->
<?php 
}
function custom_intro()
{
    echo "<div class='intro'>";
    if (is_front_page()) {
        if (get_header_image()) {
            echo '<img class="header-image" src="' . esc_url(get_header_image()) . '" alt="' . get_bloginfo('description') . '" />';
        }
    } else {
        // get title
        $id = get_option('page_for_posts');
        if (is_day() || is_month() || is_year() || is_tag() || is_category() || is_singular('post') || is_home()) {
            $the_title = get_the_title($id);
        } else {
            $the_title = get_the_title();
        }
        if (is_home() || is_singular('post')) {
            if (has_post_thumbnail($id)) {
                echo get_the_post_thumbnail($id, 'full');
            } elseif (get_header_image()) {
                echo '<img class="header-image" src="' . esc_url(get_header_image()) . '" alt="' . $the_title . '" />';
            }
        } elseif (has_post_thumbnail() && is_singular('page')) {
            the_post_thumbnail();
        } elseif (get_header_image()) {
            echo '<img class="header-image" src="' . esc_url(get_header_image()) . '" alt="' . $the_title . '" />';
        }
    }
    echo "</div>";
}
 function ci_the_post_thumbnail_full($args = array())
 {
     $args = wp_parse_args((array) $args, array('class' => '', 'noalign' => false));
     $attr = array();
     if (ci_setting('featured_full_use_full') == 'full') {
         $attr['class'] = $args['class'];
         //			if($args['noalign'] === false)
         //			{
         //				$attr['class'] .= ' '.ci_setting('featured_single_align').' ';
         //			}
         if (empty($attr['class'])) {
             unset($attr['class']);
         }
         the_post_thumbnail('ci_featured_full', $attr);
     }
     if (ci_setting('featured_full_use_full') == 'single') {
         $attr['class'] = $args['class'];
         if ($args['noalign'] === false) {
             $attr['class'] .= ' ' . ci_setting('featured_single_align') . ' ';
         }
         if (empty($attr['class'])) {
             unset($attr['class']);
         }
         the_post_thumbnail('ci_featured_single', $attr);
     }
     if (ci_setting('featured_full_use_full') == 'disabled') {
         // Do nothing
     }
 }
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $number = $instance['number'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        echo '<ul>';
        query_posts(array('post_type' => 'portfolio', 'showposts' => $number));
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>
				
				<li>
					<a href="<?php 
                the_permalink();
                ?>
">
						<?php 
                the_post_thumbnail('portfolio');
                ?>
					</a>
				</li>
				
				<?php 
            }
        }
        wp_reset_query();
        echo '</ul>';
        echo $after_widget;
    }
Example #29
0
function featured_post_image()
{
    if (!is_front_page() && is_singular()) {
        the_post_thumbnail('large');
        //you can use medium, large or a custom size
    }
}
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $show = $instance['show'];
        global $post, $wpdb;
        $themePath = THB_THEME_ROOT;
        $pop = new WP_Query();
        $pop->query('showposts=' . $show . '');
        echo $before_widget;
        echo $before_title;
        echo $title;
        echo $after_title;
        echo '<ul>';
        while ($pop->have_posts()) {
            $pop->the_post();
            ?>
	           <li>
	           	   <figure>
	               <a href="<?php 
            the_permalink();
            ?>
" rel="bookmark" title="<?php 
            the_title();
            ?>
">
	               <?php 
            if (has_post_thumbnail()) {
                the_post_thumbnail();
            } else {
                ?>
	               		<img src="<?php 
                echo THB_THEME_ROOT;
                ?>
/assets/img/nothumb.jpg" alt="No Post Image for <?php 
                the_title();
                ?>
" width="40" height="40" />
	               <?php 
            }
            ?>
	               </a>
	               </figure>
	               <a href="<?php 
            the_permalink();
            ?>
" rel="bookmark" title="<?php 
            the_title();
            ?>
" class="postlink"><?php 
            the_title();
            ?>
</a>
	           </li>
	           <?php 
        }
        echo '</ul>';
        echo $after_widget;
        wp_reset_query();
    }