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


PHP get_the_image函数代码示例

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


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

示例1: widget

 function widget($args, $instance)
 {
     extract($args);
     /* Our variables from the widget settings. */
     $page_id = (int) $instance['page_id'];
     if (empty($page_id) || $page_id < 1) {
         return false;
     }
     $page_data = get_page($page_id);
     $title = apply_filters('widget_title', trim($page_data->post_title), $instance, $this->id_base);
     $link_title = (bool) $instance['link_title'];
     if (!empty($page_data->post_content)) {
         echo $before_widget;
         get_the_image(array('post_id' => $page_data->ID, 'size' => 'featured-cat', 'width' => 310, 'height' => 220, 'before' => '<div class="post-thumb">', 'after' => '</div>'));
         if ($title) {
             echo $before_title;
             if ($link_title) {
                 echo '<a href="' . esc_url(get_permalink($page_data->ID)) . '">';
             }
             echo $title;
             if ($link_title) {
                 echo '</a>';
             }
             echo $after_title;
         }
         echo apply_filters('the_excerpt', trim($page_data->post_excerpt));
         echo $after_widget;
     }
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:29,代码来源:single-page.php

示例2: widget

 function widget($args, $instance)
 {
     extract($args);
     /* User-selected settings. */
     $title = apply_filters('widget_title', $instance['title']);
     $category = $instance['category'];
     $show_count = $instance['show_count'];
     $show_date = $instance['show_date'] ? true : false;
     $show_thumb = $instance['show_thumb'] ? true : false;
     $show_excerpt = $instance['show_excerpt'] ? true : false;
     $excerpt_length = $instance['excerpt_length'];
     $show_title = $instance['hide_title'] ? false : true;
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Title of widget (before and after defined by themes). */
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo '<ul class="wpzoom-feature-posts">';
     $query_opts = apply_filters('wpzoom_query', array('posts_per_page' => $show_count, 'post_type' => 'post'));
     if ($category) {
         $query_opts['cat'] = $category;
     }
     query_posts($query_opts);
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             echo '<li>';
             if ($show_thumb) {
                 $custom_field = option::get('cf_use') == 'on' ? get_post_meta($post->ID, option::get('cf_photo'), true) : '';
                 $args = array('size' => 'recent-widget', 'width' => $instance['thumb_width'], 'height' => $instance['thumb_height']);
                 if ($custom_field) {
                     $args['meta_key'] = option::get('cf_photo');
                 }
                 get_the_image($args);
             }
             if ($show_title) {
                 echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
             }
             if ($show_date) {
                 echo '<small>' . get_the_date() . '</small>';
             }
             if ($show_excerpt) {
                 $the_excerpt = get_the_excerpt();
                 // cut to character limit
                 $the_excerpt = substr($the_excerpt, 0, $excerpt_length);
                 // cut to last space
                 $the_excerpt = substr($the_excerpt, 0, strrpos($the_excerpt, ' '));
                 echo '<span class="post-excerpt">' . $the_excerpt . '</span>';
             }
             echo '<div class="clear"></div></li>';
         }
     } else {
     }
     //Reset query_posts
     wp_reset_query();
     echo '</ul><div class="clear"></div>';
     /* After widget (defined by themes). */
     echo $after_widget;
 }
开发者ID:aaronfrey,项目名称:PepperLillie-FiveVirtues,代码行数:60,代码来源:recentposts.php

示例3: facebook_meta

/**
 * Facebook Opengraph - Adds Facebook open graph meta fields to the theme header.
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 
 * General Public License version 2, as published by the Free Software Foundation.  You may NOT assume 
 * that you can use any other version of the GPL.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package FacebookMetaFields
 * @version 0.0.1
 * @author Jason Conroy <jason@findingsimple.com>
 * @copyright Copyright (c) 2008 - 2011, Jason Conroy
 * @link http://findingsimple.com
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */
function facebook_meta()
{
    $image = get_the_image(array('format' => 'array'));
    if (!empty($image)) {
        $image = $image['url'];
    } else {
        $image = "";
    }
    ?>
<!-- Facebook Meta --> 
<?php 
    if (is_single()) {
        ?>
<meta property="og:title" content="<?php 
        the_title();
        ?>
"/>
<meta property="og:type" content="article" />
<meta property="og:url" content="<?php 
        the_permalink();
        ?>
"/>
<meta property="og:image" content="<?php 
        echo $image;
        ?>
"/>
<meta property="og:description" content="<?php 
        echo fb_description();
        ?>
" />
<?php 
    } else {
        ?>
<meta property="og:site_name" content="<?php 
        bloginfo('name');
        ?>
" />  
<meta property="og:description" content="<?php 
        echo fb_description();
        ?>
" />  
<meta property="og:type" content="website" />  
<meta property="og:image" content="<?php 
        echo $image;
        ?>
" /> 
<?php 
    }
    ?>
<!-- END Facebook Meta -->
<?php 
}
开发者ID:nixter,项目名称:d.school,代码行数:69,代码来源:facebook-opengraph.php

示例4: bon_meta_opengraph

/**
* Generates the relevant template info for facebook opengraph
* filter hook.
*
* @since 1.3.0
* @access public
* @return void
*/
function bon_meta_opengraph()
{
    if (is_singular()) {
        global $post;
        $img = get_the_image(array('post_id' => $post->ID, 'attachment' => true, 'image_scan' => true, 'size' => 'full', 'format' => 'array', 'echo' => false));
        $content = wp_trim_words($post->post_content, $num_words = 50, $more = null);
        $title = $post->post_title;
        echo '<meta property="og:title" content="' . apply_filters('bon_og_meta_title', $title) . '" />' . " \n";
        echo '<meta property="og:description" content="' . apply_filters('bon_og_meta_desc', strip_tags(strip_shortcodes($content))) . '" />' . " \n";
        echo '<meta property="og:url" content="' . get_the_permalink() . '" />' . " \n";
        if ($img && isset($img['src'])) {
            echo '<meta property="og:image" content="' . apply_filters('bon_og_meta_image', $img['src']) . '" />' . " \n";
        }
        echo '<meta property="og:type" content="article" />' . " \n";
    }
}
开发者ID:VadimSid,项目名称:thinkgreek,代码行数:24,代码来源:head.php

示例5: widget

    /**
     * Outputs the widget based on the arguments input through the widget controls.
     *
     * @since 0.1.0
     */
    function widget($sidebar, $instance)
    {
        extract($sidebar);
        /* Output the theme's $before_widget wrapper. */
        echo $before_widget;
        /* If a title was input by the user, display it. */
        if (!empty($instance['title'])) {
            echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
        }
        $loop = new WP_Query(array('posts_per_page' => $instance['posts_per_page'], 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-gallery')))));
        if ($loop->have_posts()) {
            /* Set up some default variables to use in the gallery. */
            $gallery_columns = 3;
            $gallery_iterator = 0;
            echo '<div class="gallery">';
            while ($loop->have_posts()) {
                $loop->the_post();
                if ($gallery_columns > 0 && $gallery_iterator % $gallery_columns == 0) {
                    echo '<div class="gallery-row gallery-clear">';
                }
                ?>

						<div class="gallery-item col-<?php 
                echo esc_attr($gallery_columns);
                ?>
">
							<div class="gallery-icon">
								<?php 
                get_the_image(array('image_scan' => true, 'size' => 'thumbnail', 'meta_key' => false, 'default_image' => trailingslashit(get_template_directory_uri()) . 'images/thumbnail-default.png'));
                ?>
							</div>
						</div>

			<?php 
                if ($gallery_columns > 0 && ++$gallery_iterator % $gallery_columns == 0) {
                    echo '</div>';
                }
            }
            if ($gallery_columns > 0 && $gallery_iterator % $gallery_columns !== 0) {
                echo '</div>';
            }
            echo '</div>';
        }
        wp_reset_query();
        echo $after_widget;
    }
开发者ID:aldelpech,项目名称:clea-base,代码行数:51,代码来源:widget-gallery-posts.php

示例6: ccp_manage_portfolio_item_columns

/**
 * Displays the content of custom portfolio item columns on the edit screen.
 *
 * @since  0.1.0
 * @access public
 * @param  string  $column
 * @param  int     $post_id
 * @return void
 */
function ccp_manage_portfolio_item_columns($column, $post_id)
{
    global $post;
    switch ($column) {
        case 'thumbnail':
            if (has_post_thumbnail()) {
                the_post_thumbnail(array(40, 40));
            } elseif (function_exists('get_the_image')) {
                get_the_image(array('image_scan' => true, 'width' => 40, 'height' => 40));
            }
            break;
            /* Just break out of the switch statement for everything else. */
        /* Just break out of the switch statement for everything else. */
        default:
            break;
    }
}
开发者ID:hai2219,项目名称:bearded,代码行数:26,代码来源:admin.php

示例7: getImage

 /**
  * Returns the link to image
  */
 public static function getImage($width, $height, $location = 'c')
 {
     global $blog_id;
     $image = get_the_image(array('format' => 'array'));
     if (isset($image['src']) && $image['src'] != '') {
         $image = $image['src'];
         $imageParts = explode('/files/', $image);
         $filehost = parse_url($image);
         $localhost = $_SERVER['HTTP_HOST'];
         if (isset($imageParts[1]) && $filehost['host'] == $localhost) {
             $image = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
         }
         $location = ui::getCropLocation($location);
         return get_template_directory_uri() . '/functions/theme/thumb.php?src=' . $image . '&amp;w=' . $width . '&amp;h=' . $height . '&amp;zc=1' . '&amp;a=' . $location;
     }
     return false;
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:20,代码来源:ui.php

示例8: webnus_postfromblog

function webnus_postfromblog($attributes, $content = null)
{
    extract(shortcode_atts(array('post' => ''), $attributes));
    ob_start();
    $query = new WP_Query('p=' . $post . '');
    if ($query->have_posts()) {
        $query->the_post();
        ?>
	<article class="a-post-box">
		<figure class="latest-img"><?php 
        get_the_image(array('meta_key' => array('thumbnail', 'thumbnail'), 'size' => 'latest-cover'));
        ?>
</figure>
		<div class="latest-overlay"></div>
		<div class="latest-txt">
			<h4 class="latest-title"><a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_title();
        ?>
</a></h4>
			<span class="latest-cat"><?php 
        the_category(' / ');
        ?>
</span>
			<span class="latest-meta">
				<span class="latest-date"><i class="fa-clock-o"></i> <?php 
        the_time('d M y');
        ?>
</span>
			</span>
		</div>
    </article>
<?php 
    }
    $out = ob_get_contents();
    ob_end_clean();
    wp_reset_query();
    return $out;
}
开发者ID:kulgee001,项目名称:VoiceOfADF,代码行数:41,代码来源:postfromblog.php

示例9: feed_thumbnails

function feed_thumbnails()
{
    if (function_exists('get_the_image') and $thumb = get_the_image('format=array&echo=0')) {
        $thumb[0] = $thumb['url'];
    } else {
        if (function_exists('has_post_thumbnail') and has_post_thumbnail()) {
            $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail');
        } else {
            if (function_exists('get_post_thumbnail_src')) {
                $thumb = get_post_thumbnail_src();
                if (preg_match('|^<img src="([^"]+)"|', $thumb[0], $m)) {
                    $thumb[0] = $m[1];
                }
            } else {
                $thumb = false;
            }
        }
    }
    if (!empty($thumb)) {
        echo "\t" . '<enclosure url="' . $thumb[0] . '" />' . "\n";
    }
}
开发者ID:accre,项目名称:vu_wp_theme,代码行数:22,代码来源:functions.php

示例10: the_content

    the_content();
    ?>
				<?php 
    wp_link_pages();
    ?>
			</div><!-- .entry-content -->

		</div><!-- .wrap -->

	<?php 
} else {
    // If not viewing a single post.
    ?>

		<?php 
    get_the_image(array('size' => 'saga-large', 'min_width' => 1100, 'min_height' => 500, 'order' => array('featured', 'attachment'), 'before' => '<div class="featured-media">', 'after' => '</div>'));
    ?>

		<div class="wrap">

			<header class="entry-header">
				<?php 
    the_title('<h2 ' . hybrid_get_attr('entry-title') . '><a href="' . get_permalink() . '" rel="bookmark" itemprop="url">', '</a></h2>');
    ?>
			</header><!-- .entry-header -->

			<div <?php 
    hybrid_attr('entry-summary');
    ?>
>
				<?php 
开发者ID:8manos,项目名称:bogohack,代码行数:31,代码来源:attachment-image.php

示例11: the_ID

							<div id="post-<?php 
        the_ID();
        ?>
" class="<?php 
        hybrid_entry_class();
        ?>
">		
	
							<?php 
        do_atomic('open_entry');
        // oxygen_open_entry
        ?>
	
							<?php 
        if (current_theme_supports('get-the-image')) {
            get_the_image(array('meta_key' => 'Thumbnail', 'size' => 'archive-thumbnail', 'image_class' => 'featured', 'width' => 470, 'height' => 140, 'default_image' => get_template_directory_uri() . '/images/archive-thumbnail-placeholder.gif'));
        }
        ?>
	
							<div class="entry-header">
										
								<?php 
        echo apply_atomic_shortcode('entry_title', '[entry-title]');
        ?>
								
								<?php 
        echo apply_atomic_shortcode('byline_date', '<div class="byline byline-date">' . __('[entry-published]', 'oxygen') . '</div>');
        ?>
			
								<?php 
        echo apply_atomic_shortcode('byline_author', '<div class="byline byline-author">' . __('by [entry-author]', 'oxygen') . '</div>');
开发者ID:RA2WP,项目名称:RA2WP,代码行数:31,代码来源:index.php

示例12: get_post_meta

<?php

global $udesign_options, $post;
$the_post_thumbnail_link = get_post_meta($post->ID, 'post_thumbnail', true) ? get_post_meta($post->ID, 'post_thumbnail', true) : get_post_meta($post->ID, 'thumbnail', true);
$default_thumb = get_bloginfo('template_url') . '/styles/common-images/default-thumb.png';
$shadow_class = $thumb_frame_shadow == '' | $thumb_frame_shadow == false ? '' : ' frame-shadow';
// $thumb_frame_shadow is set in 'latestPost-widget.php' file
// the case when "Get The Image" plugin is available (installed and activated)
if (function_exists('get_the_image')) {
    if ($udesign_options['default_thumb_on'] == 'yes') {
        // Default thumbnail option is selected
        $the_thumb_html_as_array = get_the_image(array('meta_key' => array('post_thumbnail', 'thumbnail'), 'format' => 'array', 'size' => 'full', 'default_image' => $default_thumb, 'link_to_post' => false, 'image_scan' => true, 'width' => $post_thumb_width, 'height' => $post_thumb_height, 'cache' => false, 'echo' => false));
    } else {
        // Default thumbnail option is NOT selected
        $the_thumb_html_as_array = get_the_image(array('meta_key' => array('post_thumbnail', 'thumbnail'), 'format' => 'array', 'size' => 'full', 'default_image' => false, 'link_to_post' => false, 'image_scan' => true, 'width' => $post_thumb_width, 'height' => $post_thumb_height, 'cache' => false, 'echo' => false));
    }
    echo $the_thumb_html_as_array[src] ? '<span class="small-custom-frame alignleft' . $shadow_class . '"><a href="' . get_permalink() . '" title="' . __("Permanent Link to", 'udesign') . ' ' . the_title('', '', false) . '"><img src="' . get_bloginfo("template_directory") . '/scripts/timthumb.php?src=' . $the_thumb_html_as_array[url] . '&amp;w=' . $post_thumb_width . '&amp;h=' . $post_thumb_height . '&amp;zc=1&amp;q=100" width="' . $post_thumb_width . '" height="' . $post_thumb_height . '" alt="' . $the_thumb_html_as_array[alt] . '" /></a></span>' : '';
} else {
    // the case when "Get The Image" plugin is NOT available
    if ($udesign_options['default_thumb_on'] == 'yes') {
        // Default thumbnail option is selected
        if ($the_post_thumbnail_link) {
            // look for the thumbnail passed as a 'post_thumbnail' or 'thumbnail' custom field
            ?>
                    <span class="small-custom-frame alignleft<?php 
            echo $shadow_class;
            ?>
"><a href="<?php 
            the_permalink();
            ?>
" title="<?php 
开发者ID:besimhu,项目名称:legacy,代码行数:31,代码来源:post-thumbnail.php

示例13: the_title

        ?>
" title="<?php 
        the_title();
        ?>
">Permalink</a> <a href="http://www.addthis.com/bookmark.php?v=250&amp;pubid=xa-4db9efe25b1310bd" title="Share" class="addthis_button">Share</a>
							<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4db9efe25b1310bd"></script>
					
							</div>


						</div><!-- .entry-summary -->

						<div class="feature-container">
						<?php 
        if (current_theme_supports('get-the-image')) {
            get_the_image(array('meta_key' => 'Thumbnail', 'size' => 'full', 'image_class' => 'page-feature', 'link_to_post' => false));
        }
        ?>
						</div>

						<?php 
        do_atomic('close_entry');
        // dschool_close_entry
        ?>

					</div><!-- .hentry -->

					<?php 
        do_atomic('after_entry');
        // dschool_after_entry
        ?>
开发者ID:nixter,项目名称:d.school,代码行数:31,代码来源:home.php

示例14: comments_popup_link

				<?php 
    comments_popup_link(number_format_i18n(0), number_format_i18n(1), '%', 'comments-link', '');
    ?>
				<?php 
    edit_post_link();
    ?>
			</div><!-- .entry-byline -->

		</header><!-- .entry-header -->

		<div <?php 
    hybrid_attr('entry-summary');
    ?>
>
			<?php 
    get_the_image();
    ?>
			<?php 
    the_excerpt();
    ?>
		</div><!-- .entry-summary -->
		
		<footer class="entry-footer">
			<?php 
    hybrid_post_terms(array('taxonomy' => 'category', 'text' => esc_html__('Posted in %s', 'magik')));
    ?>
			<?php 
    hybrid_post_terms(array('taxonomy' => 'post_tag', 'text' => esc_html__('Tagged %s', 'magik')));
    ?>
		</footer><!-- .entry-footer -->
开发者ID:MagikPress,项目名称:magik,代码行数:30,代码来源:content.php

示例15: tha_entry_before

<?php 
tha_entry_before();
?>

<article <?php 
hybrid_attr('post');
?>
>

	<?php 
tha_entry_top();
?>

	<?php 
// Display a featured image if one has been set.
get_the_image(array('size' => 'compass-full', 'before' => '<div class="featured-media image">', 'after' => '</div>'));
?>

	<header class="entry-header">

		<?php 
the_title('<h2 ' . hybrid_get_attr('entry-title') . '><a href="' . get_permalink() . '" rel="bookmark" itemprop="url">', '</a></h2>');
?>

		<p class="entry-meta">
			<?php 
hybrid_post_format_link();
?>
			<span <?php 
hybrid_attr('entry-author');
?>
开发者ID:stedy67,项目名称:Compass,代码行数:31,代码来源:gallery.php


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