当前位置: 首页>>代码示例>>PHP>>正文


PHP get_post_thumb函数代码示例

本文整理汇总了PHP中get_post_thumb函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_thumb函数的具体用法?PHP get_post_thumb怎么用?PHP get_post_thumb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_post_thumb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: caption_handler

function caption_handler($atts, $content = null, $code = "")
{
    /* title */
    if (isset($atts["title"])) {
        $title_i = $atts["title"];
    } else {
        $title_i = "";
    }
    /* url */
    if (isset($atts["url"])) {
        $url_i = $atts["url"];
    } else {
        $url_i = "";
    }
    $image = get_post_thumb(false, 340, 225, false, $url_i);
    $blog_url = get_template_directory_uri();
    $return = '		
				<div class="image-caption aligncenter">
					<a href="' . $url_i . '" class="lightbox-photo" title="' . $title_i . '">
						<img alt="' . $title_i . '" src="' . $image['src'] . '" />
					</a>

					<p>' . $title_i . '</p>
				</div>
				';
    return $return;
}
开发者ID:trantuanvn,项目名称:coffeeletsgo,代码行数:27,代码来源:caption.php

示例2: widget

    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', $instance['title']);
        $tags = $instance['tags'];
        $number = $instance['number'];
        global $post;
        if (!empty($tags)) {
            $query = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'tag' => $tags);
        } else {
            $query = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
        }
        $loop = new WP_Query($query);
        /* Before widget (defined by themes). */
        echo $before_widget;
        if ($loop->have_posts()) {
            /* Display the widget title if one was input (before and after defined by themes). */
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>
		<div class="postimageside">		
		<?php 
            while ($loop->have_posts()) {
                $loop->the_post();
                ?>
		<?php 
                $img = get_post_thumb();
                ?>
	
		<div class="wrap">
			<a href="<?php 
                the_permalink();
                ?>
" class="view-link">
				<?php 
                wpsm_thumb('grid_news');
                ?>
				<h4><?php 
                the_title();
                ?>
</h4>
			</a>	
		</div>	
		<?php 
            }
            ?>
		</div>
		<?php 
            wp_reset_query();
            ?>
		<?php 
        }
        ?>
			
	<?php 
        /* After widget (defined by themes). */
        echo $after_widget;
    }
开发者ID:rhondamoananui,项目名称:rehub,代码行数:63,代码来源:imagegrid_sidebar.php

示例3: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $count = $instance['count'];
        ?>
              <?php 
        echo $before_widget;
        ?>
	

					<div class="title"><h3><?php 
        echo $title;
        ?>
</h3></div>
					<!-- BEGIN .popular-galleries -->
					<div class="popular-galleries">
				
						<?php 
        $args = array('post_status' => null, 'numberposts' => $count, 'post_type' => 'gallery');
        $posts = get_posts($args);
        if (count($posts) > 0) {
            foreach ($posts as $post) {
                $image = get_post_thumb($post->ID, 51, 51);
                ?>
										<a href="<?php 
                echo get_permalink($post->ID);
                ?>
">
											<img src="<?php 
                echo $image['src'];
                ?>
" alt="<?php 
                echo $post->title;
                ?>
" title="<?php 
                echo $post->title;
                ?>
" width="51" height="51" />
										</a>

										<?php 
            }
        }
        ?>
					<!-- END .popular-galleries -->
					</div>
					

												
				<?php 
        echo $after_widget;
        ?>
        <?php 
    }
开发者ID:bangjojo,项目名称:wp,代码行数:55,代码来源:widget-bordeaux-gallery.php

示例4: gallery_handler

function gallery_handler($atts, $content = null, $code = "")
{
    if (isset($atts['url'])) {
        if (substr($atts['url'], -1) == '/') {
            $atts['url'] = substr($atts['url'], 0, -1);
        }
        $vars = explode('/', $atts['url']);
        $slug = $vars[count($vars) - 1];
        $page = get_page_by_path($slug, 'OBJECT', OT_POST_GALLERY);
        if (is_object($page)) {
            $id = $page->ID;
            if (is_numeric($id)) {
                $gallery_style = get_post_meta($id, THEME_NAME . "_gallery_style", true);
                $galleryImages = get_post_meta($id, THEME_NAME . "_gallery_images", true);
                $imageIDs = explode(",", $galleryImages);
                $count = count($imageIDs);
                if ($gallery_style == "lightbox") {
                    $classL = 'light-show ';
                } else {
                    $classL = false;
                }
                $content .= '<div class="gallery-preview-box-wrapper">';
                $content .= '<div class="gallery-preview-box">';
                $content .= '<p><b>' . __("Photo gallery:", THEME_NAME) . '</b> ' . $page->post_title . '</p>';
                $counter = 1;
                foreach ($imageIDs as $imgID) {
                    if ($counter == 5) {
                        break;
                    }
                    if ($imgID) {
                        $file = wp_get_attachment_url($imgID);
                        $image = get_post_thumb(false, 80, 80, false, $file);
                        $content .= '<a href="' . $atts['url'] . '?page=' . $counter . '" class="border-image ' . $classL . '" data-id="gallery-' . $id . '">
														<img src="' . $image['src'] . '" alt="' . $page->post_title . '" title="' . $page->post_title . '" data-id="' . $counter . '"/>
													</a>';
                    }
                    $counter++;
                }
                $content .= '<a href="' . $atts['url'] . '" class="show-all-photos">' . __("show<br/>all<br/>photos", THEME_NAME) . '</a>';
                $content .= '</div>';
                $content .= '</div>';
            } else {
                $content .= "Incorrect URL attribute defined";
            }
        } else {
            $content .= "Incorrect URL attribute defined";
        }
    } else {
        $content .= "No url attribute defined!";
    }
    return $content;
}
开发者ID:trantuanvn,项目名称:coffeeletsgo,代码行数:52,代码来源:gallery-box.php

示例5: add_image_thumb_2

function add_image_thumb_2($content)
{
    global $post;
    $img = get_post_thumb($post->ID, 600, 180);
    if ($img['show'] != false) {
        if ($img['src'] != "") {
            $img = '<img src="' . $img['src'] . '" alt="article-image" class="post-image-2" width="600" height="180"/>';
            return $img . " " . $content;
        } else {
            return $content;
        }
    } else {
        return $content;
    }
}
开发者ID:bangjojo,项目名称:wp,代码行数:15,代码来源:thumbs.php

示例6: add_image_thumb

function add_image_thumb($content)
{
    global $post;
    $img = get_post_thumb($post->ID, 680, 230);
    if ($img['show'] != false) {
        if ($img['src'] != "") {
            $img = '<a href="#" class="image-overlay-1 main-image"><span><img src="' . $img['src'] . '" class="trans-1" alt="' . get_the_title() . '"/></span></a>';
            return $img . " " . $content;
        } else {
            return $content;
        }
    } else {
        return $content;
    }
}
开发者ID:trantuanvn,项目名称:coffeeletsgo,代码行数:15,代码来源:thumbs.php

示例7: ot_get_option

if (is_category()) {
    $blogStyle = ot_get_option($catId, "blog_style");
} else {
    $blogStyle = get_option(THEME_NAME . "_blog_style");
}
if (!isset($blogStyle) || $blogStyle == "") {
    $blogStyle = get_option(THEME_NAME . "_blog_style");
}
if ($blogStyle == "2") {
    $width = 600;
    $height = 180;
} else {
    $width = 100;
    $height = 100;
}
$image = get_post_thumb($post->ID, $width, $height);
if (get_option(THEME_NAME . "_show_first_thumb") == "on" && $image['show'] == true) {
    ?>

	<div class="image">
		<a href="<?php 
    the_permalink();
    ?>
">
			<?php 
    echo ot_image_html($post->ID, $width, $height);
    ?>
		</a>
	</div>

<?php 
开发者ID:trantuanvn,项目名称:coffeeletsgo,代码行数:31,代码来源:image.php

示例8: OT_lightbox_gallery

function OT_lightbox_gallery()
{
    $g = $_POST['gallery_id'];
    $next_image = $_POST['next_image'];
    $galleryImages = get_post_meta($g, THEME_NAME . "_gallery_images", true);
    $imageIDs = explode(",", $galleryImages);
    $c = 0;
    $images = array();
    $thumbs = array();
    foreach ($imageIDs as $id) {
        $file = wp_get_attachment_url($id);
        $image = get_post_thumb(false, 650, 0, false, $file);
        $images[] = $image['src'];
        $thumb = get_post_thumb(false, 110, 110, false, $file);
        $thumbs[$c] = $thumb['src'];
        $c++;
    }
    $thispost = get_post($g);
    $content = do_shortcode($thispost->post_content);
    $return = array();
    $return['next'] = $images[$next_image - 1];
    $return['thumbs'] = $thumbs;
    $return['title'] = get_the_title($g);
    $return['content'] = $content;
    $return['total'] = $c;
    echo json_encode($return);
    die;
}
开发者ID:trantuanvn,项目名称:coffeeletsgo,代码行数:28,代码来源:ajax.php

示例9: get_option

<?php

//social share icons
$shareAll = get_option(THEME_NAME . "_share_all");
$shareSingle = get_post_meta($post->ID, THEME_NAME . "_share_single", true);
$image = get_post_thumb($post->ID, 0, 0);
?>

		<?php 
if ($shareAll == "show" || $shareAll == "custom" && $shareSingle == "show") {
    ?>
				<hr />
				<div>
					<a href="http://www.facebook.com/sharer/sharer.php?u=<?php 
    the_permalink();
    ?>
" data-url="<?php 
    the_permalink();
    ?>
" data-url="<?php 
    the_permalink();
    ?>
" class="soc-share i-facebook ot-share">
						<i class="fa fa-facebook"></i><?php 
    _e("Facebook", THEME_NAME);
    ?>
<span class="count">0</span>
					</a>
				</div>
				<div>
					<a href="#" data-hashtags="" data-url="<?php 
开发者ID:trantuanvn,项目名称:coffeeletsgo,代码行数:31,代码来源:share.php

示例10: while

        if ($my_query->have_posts()) {
            while ($my_query->have_posts()) {
                $my_query->the_post();
                ?>
													
													<?php 
                if ($counter == 1) {
                    ?>
<!-- BEGIN .row --><div class="row"> <?php 
                }
                ?>
													
													<!-- BEGIN .index-item -->
													<div class="index-item">
														<?php 
                $src = get_post_thumb($post->ID, 135, 135);
                ?>
														<a href="<?php 
                the_permalink();
                ?>
"><img src="<?php 
                echo $src["src"];
                ?>
" alt="<?php 
                the_title();
                ?>
" width="135" height="135"/></a>
														<a href="<?php 
                the_permalink();
                ?>
"><?php 
开发者ID:bangjojo,项目名称:wp,代码行数:31,代码来源:template-gallery.php

示例11: apply_filters

// Exit if accessed directly
global $post, $product, $woocommerce;
$attachment_ids = $product->get_gallery_attachment_ids();
if ($attachment_ids) {
    ?>
	<div class="woocommerce-pager"><?php 
    $loop = 0;
    $columns = apply_filters('woocommerce_product_thumbnails_columns', 3);
    foreach ($attachment_ids as $attachment_id) {
        $classes = array('');
        if ($loop == 0 || $loop % $columns == 0) {
            $classes[] = 'first';
        }
        if (($loop + 1) % $columns == 0) {
            $classes[] = 'last';
        }
        $image_link = wp_get_attachment_url($attachment_id);
        if (!$image_link) {
            continue;
        }
        $image = get_post_thumb(false, 60, 60, false, $image_link);
        $image_class = esc_attr(implode(' ', $classes));
        $image_title = esc_attr(get_the_title($attachment_id));
        $image = '<img src="' . $image["src"] . '" alt="' . $image_title . '" title="' . $image_title . '" />';
        echo apply_filters('woocommerce_single_product_image_thumbnail_html', sprintf('<a href="%s" class="%s" title="%s" data-slide-index="%s">%s</a>', $image_link, $image_class, $image_title, $loop, $image), $attachment_id, $post->ID, $image_class);
        $loop++;
    }
    ?>
</div>
	<?php 
}
开发者ID:trantuanvn,项目名称:coffeeletsgo,代码行数:31,代码来源:product-thumbnails.php

示例12: the_permalink

            ?>
                <div class="edd_download" itemtype="http://schema.org/Product" itemscope="">
                    <div class="edd_download_inner">
                        <div class="edd_download_image">
                            <?php 
            if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
                ?>
                                <a href="<?php 
                the_permalink();
                ?>
">
                                <?php 
                if (rehub_option('aq_resize') == 1) {
                    ?>
                                    <?php 
                    $img = get_post_thumb();
                    ?>
 
                                    <img src="<?php 
                    $params = array('width' => 336, 'height' => 220);
                    echo bfi_thumb($img, $params);
                    ?>
" alt="<?php 
                    the_title_attribute();
                    ?>
" />
                                <?php 
                } else {
                    ?>
    
                                    <?php 
开发者ID:rhondamoananui,项目名称:rehub,代码行数:31,代码来源:taxonomy-download_category.php

示例13: lo_get_thumb

/**
 * Get thumbnails. Return a string
 * Default size is 150 X 150 (px)
 * 
 * @since 1.0
 */
function lo_get_thumb($width = 150, $height = 150, $img = '')
{
    global $post;
    if ($img) {
        return '<img itemprop="image" src="' . get_template_directory_uri() . '/timthumb.php?src=' . $img . '&amp;h=' . $height . '&amp;w=' . $width . '&amp;a=c" alt="' . get_the_title($post->ID) . '">';
    }
    $img = get_post_thumb();
    if ($img) {
        return '<img itemprop="image" src="' . get_template_directory_uri() . '/timthumb.php?src=' . $img . '&amp;h=' . $height . '&amp;w=' . $width . '&amp;a=c" alt="' . get_the_title($post->ID) . '">';
    }
}
开发者ID:frostfan,项目名称:Lost,代码行数:17,代码来源:functions.php

示例14: rehub_create_column

    function rehub_create_column($size = 'middle')
    {
        ?>
<article class="rething_item small_post inf_scr_item">
    <?php 
        if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
            ?>
        <figure>
            <?php 
            rehub_formats_icons('full');
            ?>
            <span class="pattern"></span>
            <?php 
            echo getPostLikeLink(get_the_ID());
            ?>
            <?php 
            rehub_permalink();
            ?>
                <?php 
            $img = get_post_thumb();
            $nothumb = get_stylesheet_directory_uri() . '/images/noim.png';
            if ($size == 'middle') {
                $params = array('width' => 381, 'height' => 255, 'crop' => true);
            } elseif ($size == 'small') {
                $params = array('width' => 280, 'height' => 186, 'crop' => true);
            } elseif ($size == 'big') {
                $params = array('width' => 579, 'height' => 386, 'crop' => true);
            } else {
                $params = array('width' => 381, 'height' => 255, 'crop' => true);
            }
            ?>
				<?php 
            if (!empty($img)) {
                ?>
                	<img src="<?php 
                echo bfi_thumb($img, $params);
                ?>
" alt="<?php 
                the_title_attribute();
                ?>
" />
                <?php 
            } else {
                ?>
    
                    <img src="<?php 
                echo $nothumb;
                ?>
" alt="<?php 
                the_title_attribute();
                ?>
" />
                <?php 
            }
            ?>
            </a>
        </figure>                                     
    <?php 
        }
        ?>
    <div class="wrap_thing">
        <div class="top">
            <?php 
        $category = get_the_category(get_the_ID());
        ?>
            <?php 
        if ($category) {
            $first_cat = $category[0]->term_id;
            meta_small(false, $first_cat, false, false);
        }
        ?>
        </div>
        <div class="hover_anons">
            <h2><?php 
        rehub_permalink();
        the_title();
        ?>
</a></h2>
            <div class="post-meta"> <?php 
        meta_small(true, false, true, false);
        ?>
 </div>
            <?php 
        rehub_format_score('small');
        ?>
            <p><?php 
        kama_excerpt('maxchar=320');
        ?>
</p>
        </div>
        <?php 
        rehub_create_btn('yes');
        ?>
    </div>
</article>

<?php 
    }
开发者ID:rhondamoananui,项目名称:rehub,代码行数:98,代码来源:functions.php

示例15: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $countP = $instance['count_p'];
        $countR = $instance['count_r'];
        $countC = $instance['count_c'];
        //popular post args
        $argsP = array('posts_per_page' => $countP, 'order' => 'DESC', 'orderby' => 'meta_value_num', 'meta_key' => THEME_NAME . '_post_views_count', 'post_type' => 'post');
        //recent post args
        $argsR = array('posts_per_page' => $countR);
        //commnet post args
        $argsC = array('status' => 'approve', 'order' => 'DESC', 'number' => $countC);
        $comments = get_comments($argsC);
        $totalCount = count($comments);
        $the_query_p = new WP_Query($argsP);
        $the_query_r = new WP_Query($argsR);
        //post counts
        $totalCountP = $the_query_p->found_posts;
        $totalCountR = $the_query_r->found_posts;
        $blogID = get_option('page_for_posts');
        $postDate = get_option(THEME_NAME . "_post_date");
        $postComments = get_option(THEME_NAME . "_post_comment");
        ?>
		
	<?php 
        echo $before_widget;
        ?>
		<?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
			<div class="tabs">

				<ul class="tab-navi">
					<li class="active"><a href="#"><span><?php 
        _e("Popular", THEME_NAME);
        ?>
</span></a></li>
					<li><a href="#"><span><?php 
        _e("Recent", THEME_NAME);
        ?>
</span></a></li>
					<li><a href="#"><span><?php 
        _e("Comments", THEME_NAME);
        ?>
</span></a></li>
				</ul>

				<!-- BEGIN .latest-activity -->
				<div class="latest-activity active">
					<?php 
        if ($the_query_p->have_posts()) {
            while ($the_query_p->have_posts()) {
                $the_query_p->the_post();
                ?>
					<?php 
                $image = get_post_thumb($the_query_p->post->ID, 0, 0);
                ?>
	
						<div class="activity-item<?php 
                if ($image['show'] != true) {
                    ?>
 no-image<?php 
                }
                ?>
">
							<div class="image">
								<?php 
                if ($image['show'] == true) {
                    ?>
									<a href="<?php 
                    the_permalink();
                    ?>
">
										<?php 
                    echo ot_image_html($the_query_p->post->ID, 60, 60);
                    ?>
									</a>
								<?php 
                }
                ?>
							</div>
							<div class="text">
								<h5><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h5>
								<p><a href="<?php 
                the_permalink();
                ?>
" class="more-link"><i><?php 
                _e("Read more", THEME_NAME);
                ?>
</i></a></p>
							</div>
//.........这里部分代码省略.........
开发者ID:trantuanvn,项目名称:coffeeletsgo,代码行数:101,代码来源:widget-bordeaux-triple-box.php


注:本文中的get_post_thumb函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。