本文整理汇总了PHP中get_post_thumbnail_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_thumbnail_id函数的具体用法?PHP get_post_thumbnail_id怎么用?PHP get_post_thumbnail_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_post_thumbnail_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: charity_vc_our_mission
function charity_vc_our_mission($atts, $content = null)
{
extract(shortcode_atts(array('our_mission' => ''), $atts));
$page_id = get_page_by_title($our_mission);
$missionQuery = new WP_Query(array("page_id" => $page_id->ID));
if ($missionQuery->have_posts()) {
$missionQuery->the_post();
$url = wp_get_attachment_image_src(get_post_thumbnail_id($page_id->ID), array(1143, 479));
?>
<!-- Save Lives Section Start Here-->
<section class="save-lives text-center parallax" style="background-image: url('<?php
echo esc_url($url[0]);
?>
')">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<header class="page-header">
<h2><?php
the_title();
?>
</h2>
<?php
the_content();
?>
</header>
</div>
</div>
</div>
</section>
<!-- Save Lives Section Start Here-->
<?php
}
wp_reset_postdata();
}
开发者ID:kautzar,项目名称:drpp4,代码行数:35,代码来源:our-mission.php
示例2: ya_product_thumbnail
function ya_product_thumbnail($size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
global $post;
$html = '';
$id = get_the_ID();
$gallery = get_post_meta($id, '_product_image_gallery', true);
$attachment_image = '';
if (!empty($gallery)) {
$gallery = explode(',', $gallery);
$first_image_id = $gallery[0];
$attachment_image = wp_get_attachment_image($first_image_id, $size, false, array('class' => 'hover-image back'));
}
$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), '');
if (has_post_thumbnail()) {
if ($attachment_image) {
$html .= '<div class="product-thumb-hover">';
$html .= get_the_post_thumbnail($post->ID, $size) ? get_the_post_thumbnail($post->ID, $size) : '<img src="' . get_template_directory_uri() . '/assets/img/placeholder/' . $size . '.png" alt="No thumb">';
$html .= $attachment_image;
$html .= '</div>';
/* quickview */
$nonce = wp_create_nonce("ya_quickviewproduct_nonce");
$link = admin_url('admin-ajax.php?ajax=true&action=ya_quickviewproduct&post_id=' . $post->ID . '&nonce=' . $nonce);
$html .= '<a href="' . $link . '" data-fancybox-type="ajax" class="group fancybox fancybox.ajax">' . apply_filters('out_of_stock_add_to_cart_text', __('Quick View ', 'yatheme')) . '</a>';
} else {
$html .= get_the_post_thumbnail($post->ID, $size) ? get_the_post_thumbnail($post->ID, $size) : '<img src="' . get_template_directory_uri() . '/assets/img/placeholder/' . $size . '.png" alt="No thumb">';
}
return $html;
} else {
$html .= '<img src="' . get_template_directory_uri() . '/assets/img/placeholder/' . $size . '.png" alt="No thumb">';
return $html;
}
}
开发者ID:junibrosas,项目名称:shoppingyourway,代码行数:32,代码来源:woocommerce-hook.php
示例3: get_grid_archive_theme
/**
* Returns classic grid element for a given product
*
* @param object $post Product post object
* @param string $archive_template
* @return string
*/
function get_grid_archive_theme($post, $archive_template = null)
{
$archive_template = isset($archive_template) ? $archive_template : get_product_listing_template();
$return = '';
if ($archive_template == 'grid') {
$image_id = get_post_thumbnail_id($post->ID);
$thumbnail_product = wp_get_attachment_image_src($image_id, 'classic-grid-listing');
$product_name = get_product_name();
if ($thumbnail_product) {
$img_class['alt'] = $product_name;
$img_class['class'] = 'classic-grid-image';
$image = wp_get_attachment_image($image_id, 'classic-grid-listing', false, $img_class);
} else {
$url = default_product_thumbnail_url();
$image = '<img src="' . $url . '" class="classic-grid-image" alt="' . $product_name . '" >';
}
$archive_price = apply_filters('archive_price_filter', '', $post);
$classic_grid_settings = get_classic_grid_settings();
$row_class = get_row_class($classic_grid_settings);
$return = '<div class="archive-listing product-' . $post->ID . ' classic-grid ' . $row_class . ' ' . product_class($post->ID) . '">';
$return .= '<a href="' . get_permalink() . '">';
//$return .= '<div style="background-image:url(\'' . $url . '\');" class="classic-grid-element"></div>';
$return .= '<div class="classic-grid-image-wrapper"><div class="pseudo"></div><div class="image">' . $image . '</div></div>';
$return .= '<h3 class="product-name">' . $product_name . '</h3>' . $archive_price . '</a></div>';
}
return $return;
}
开发者ID:nanookYs,项目名称:orientreizen,代码行数:34,代码来源:classic-grid.php
示例4: vr_set_featured_background
function vr_set_featured_background()
{
$page_for_posts = get_option('page_for_posts');
$image_url = wp_get_attachment_image_src(get_post_thumbnail_id($page_for_posts), full, false);
if ($image_url[0]) {
?>
<style>
html,body {
height:100%;
margin:0!important;
}
body {
background:url(<?php
echo $image_url[0];
?>
) #fff center center repeat;
}
.wrapper {
height: auto;
}
</style>
<?php
}
//end if statement
}
开发者ID:WordPress-Wizards,项目名称:wp-food,代码行数:25,代码来源:tag.php
示例5: al_portfolio_meta_tags
function al_portfolio_meta_tags()
{
$post_type = get_post_type();
if ('portfolio' == $post_type) {
$title = get_post_meta(get_the_ID(), "al_pf_og_title", TRUE);
$title = !empty($title) ? $title : get_the_title();
$meta = array('og:title' => $title, 'og:url' => get_permalink());
$desc = get_post_meta(get_the_ID(), "al_pf_og_description", TRUE);
$desc = !empty($desc) ? $desc : false;
if ($desc) {
$meta['og:description'] = $desc;
}
if (has_post_thumbnail()) {
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$meta['og:image'] = $thumbnail[0];
}
if (get_post_format() == 'gallery') {
$images = rwmb_meta('al_pf_gallery_images', 'type=image&size=full');
if (is_array($images)) {
foreach ($images as $image) {
$meta['images'][] = $image['url'];
}
}
}
foreach ($meta as $key => $value) {
if ($key == 'images') {
foreach ($value as $image) {
echo '<meta property="og:image" content="' . $image . '" />';
}
} else {
echo '<meta property="' . $key . '" content="' . $value . '" />';
}
}
}
}
开发者ID:azeemgolive,项目名称:thefunkidsgame,代码行数:35,代码来源:artless-portfolio.php
示例6: ac_render_ac_easy_slideshow
function ac_render_ac_easy_slideshow($full_width = false, $type = 'royalslider')
{
// We need to build an array of posts to pass through to the RoyalSlider function
$posts = array();
// Should we include the featured image?
if (has_post_thumbnail() && ac_get_meta('include_featured_image') == 1) {
$posts[] = get_post(get_post_thumbnail_id());
}
// Get the images to use
$images = ac_get_meta('images', array('type' => 'image_advanced'));
// Add them to the slides
foreach ($images as $image) {
// Add to our slides
$posts[] = get_post($image['ID']);
}
$args = array('slider_style' => 'no-caption', 'slider_size' => 'square', 'class' => 'ac_easy_slider');
if ($full_width) {
$args['full_width'] = true;
}
// Render the slideshow
if (count($posts)) {
if ($type == 'royalslider') {
echo ac_render_posts_slideshow($args, $posts);
} else {
echo ac_render_slick_carousel($args, $posts);
}
return true;
}
return false;
}
开发者ID:Jhorton4,项目名称:Bohldfeys_Portfolio,代码行数:30,代码来源:functions.slideshows.php
示例7: get_data
/**
* Compile the schema.org event data into an array
*/
public function get_data($post = null, $args = array())
{
if (!$post instanceof WP_Post) {
$post = Tribe__Main::post_id_helper($post);
}
$post = get_post($post);
if (!$post instanceof WP_Post) {
return array();
}
$data = (object) array();
// We may need to prevent the context to be triggered
if (!isset($args['context']) || false !== $args['context']) {
$data->{'@context'} = 'http://schema.org';
}
$data->{'@type'} = $this->type;
$data->name = esc_js(get_the_title($post));
$data->description = esc_js(tribe_events_get_the_excerpt($post));
if (has_post_thumbnail($post)) {
$data->image = wp_get_attachment_url(get_post_thumbnail_id($post));
}
$data->url = esc_url_raw(get_permalink($post));
// Index by ID: this will allow filter code to identify the actual event being referred to
// without injecting an additional property
return array($post->ID => $data);
}
开发者ID:nullify005,项目名称:shcc-website,代码行数:28,代码来源:Abstract.php
示例8: build_data
/**
* Compile the schema.org event data into an array
*/
private function build_data()
{
global $post;
$id = $post->ID;
$events_data = array();
// Index by ID: this will allow filter code to identify the actual event being referred to
// without injecting an additional property
$events_data[$id] = new stdClass();
$events_data[$id]->{'@context'} = 'http://schema.org';
$events_data[$id]->{'@type'} = 'Event';
$events_data[$id]->name = get_the_title();
if (has_post_thumbnail()) {
$events_data[$id]->image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
}
$events_data[$id]->url = get_the_permalink($post->ID);
$events_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
$events_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
if (tribe_has_venue($id)) {
$events_data[$id]->location = new stdClass();
$events_data[$id]->location->{'@type'} = 'Place';
$events_data[$id]->location->name = tribe_get_venue($post->ID);
$events_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID)));
}
/**
* Allows the event data to be modifed by themes and other plugins.
*
* @param array $events_data objects representing the Google Markup for each event.
*/
$events_data = apply_filters('tribe_google_event_data', $events_data);
// Strip the post ID indexing before returning
$events_data = array_values($events_data);
return $events_data;
}
开发者ID:chicosilva,项目名称:olharambiental,代码行数:36,代码来源:Google_Data_Markup.php
示例9: dfi_download_featured_images
/**
*
* @global type $post
*
*/
function dfi_download_featured_images()
{
global $post;
//get featured enable lists
$post_options = (array) json_decode(get_option('featured_enable'));
$singular = '';
$is_page = '';
if (!empty($post_options['page'])) {
$is_page = is_page();
unset($post_options['page']);
}
if (!empty($post_options)) {
$post_options = array_values($post_options);
$singular = is_singular($post_options);
} else {
$singular = $is_page;
}
if (!empty($post_options) && $is_page != '') {
$singular = $is_page || $singular;
}
// echo '<pre>';
// print_r($post_options);
// exit;
if ($singular && has_post_thumbnail()) {
$url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
$icon = get_post_meta($post->ID, 'featured_download', true);
if ($url[0] != '' && $icon == 'yes') {
dfi_add_download_button($url[0]);
}
}
}
开发者ID:shaile,项目名称:shail-wp,代码行数:36,代码来源:index.php
示例10: get_tour_info
function get_tour_info()
{
$tourinfo = array();
$tour_ID = get_the_ID();
$tour_title = get_the_title();
$tour_feat_image_url = get_no_img_url();
if (has_post_thumbnail()) {
$tour_feat_image_url = wp_get_attachment_url(get_post_thumbnail_id());
}
$tour_excerpt = get_the_excerpt();
$tour_post_link = get_permalink($tour_ID);
$tour_departure = get_location_ID(get_post_meta($tour_ID, 'tour_departure', true));
$tour_arrival = get_location_ID(get_post_meta($tour_ID, 'tour_arrival', true));
$tour_price = get_post_meta($tour_ID, 'tour_price', true);
$tour_price_discount = get_post_meta($tour_ID, 'tour_price_discount', true);
$tour_start = get_post_meta($tour_ID, 'tour_start', true);
$tour_end = get_post_meta($tour_ID, 'tour_end', true);
$tour_days = get_post_meta($tour_ID, 'tour_days', true);
$tourinfo['tour_ID'] = $tour_ID;
$tourinfo['tour_title'] = $tour_title;
$tourinfo['tour_feat_image_url'] = $tour_feat_image_url;
$tourinfo['tour_excerpt'] = $tour_excerpt;
$tourinfo['tour_post_link'] = $tour_post_link;
$tourinfo['tour_departure'] = $tour_departure;
$tourinfo['tour_arrival'] = $tour_arrival;
$tourinfo['tour_price'] = $tour_price;
$tourinfo['tour_price_discount'] = $tour_price_discount;
$tourinfo['tour_start'] = $tour_start;
$tourinfo['tour_end'] = $tour_end;
$tourinfo['tour_days'] = $tour_days;
return $tourinfo;
}
开发者ID:KennyNguyen88,项目名称:ndt-hangdong,代码行数:32,代码来源:functions.php
示例11: skeleton_og_meta_tags
/**
* Display the Open Graph meta tags.
* Add more to this if needed.
*
* See: https://developers.facebook.com/docs/sharing/webmasters and http://ogp.me/
*/
function skeleton_og_meta_tags()
{
if (is_single() || is_page()) {
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<meta name="og:description" content="<?php
the_excerpt_rss();
?>
">
<meta name="og:image" content="<?php
echo skeleton_get_thumbnail_src(get_post_thumbnail_id());
?>
">
<?php
}
}
} elseif (is_home()) {
?>
<meta name="og:description" content="<?php
bloginfo('description');
?>
">
<?php
}
}
开发者ID:sayme,项目名称:skeleton,代码行数:33,代码来源:template-tags.php
示例12: post_thumbnail_src
function post_thumbnail_src()
{
global $post;
if ($values = get_post_custom_values("thumb")) {
//输出自定义域图片地址
$values = get_post_custom_values("thumb");
$post_thumbnail_src = $values[0];
} elseif (has_post_thumbnail()) {
//如果有特色缩略图,则输出缩略图地址
$thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
$post_thumbnail_src = $thumbnail_src[0];
} else {
$post_thumbnail_src = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$post_thumbnail_src = $matches[1][0];
//获取该图片 src
if (empty($post_thumbnail_src)) {
//如果日志中没有图片,则显示随机图片
$random = mt_rand(1, 10);
echo get_bloginfo('template_url');
echo '/images/random/' . $random . '.jpg';
//如果日志中没有图片,则显示默认图片
//echo '/images/default_thumb.jpg';
}
}
echo $post_thumbnail_src;
}
开发者ID:Germey,项目名称:SflBlog,代码行数:29,代码来源:functions.php
示例13: erm_get_menu_item_data
/**
* Get post type erm_menu_item data
*
* @since 1.0
* @param $id
* @return array
*/
function erm_get_menu_item_data($id)
{
$post = get_post($id);
if ($post && get_post_type($id) == 'erm_menu_item') {
$visible = get_post_meta($id, '_erm_visible', true);
if (has_post_thumbnail($id)) {
$thumbnail_id = get_post_thumbnail_id($id);
$image_src_thumb = wp_get_attachment_image_src($thumbnail_id);
$image_src_thumb = isset($image_src_thumb[0]) ? $image_src_thumb[0] : '';
$image_src_big = wp_get_attachment_image_src($thumbnail_id, 'full');
$image_src_big = isset($image_src_big[0]) ? $image_src_big[0] : '';
$post_image = get_post($thumbnail_id);
$image_title = $post_image->post_excerpt;
$image_desc = $post_image->post_content;
} else {
$thumbnail_id = 0;
$image_src_thumb = '';
$image_src_big = '';
$image_title = '';
$image_desc = '';
}
$prices = get_post_meta($id, '_erm_prices', true);
return array('id' => intval($id), 'type' => get_post_meta($id, '_erm_type', true), 'visible' => $visible ? 1 : 0, 'title' => $post->post_title, 'content' => $post->post_content, 'image_id' => intval($thumbnail_id), 'src_thumb' => $image_src_thumb, 'src_big' => $image_src_big, 'image_title' => $image_title, 'image_desc' => $image_desc, 'prices' => $prices, 'link' => get_edit_post_link($id));
}
return array();
}
开发者ID:AlexanderDolgan,项目名称:ojahuri,代码行数:33,代码来源:functions.php
示例14: afi_metabox
/**
* Markup for the advanced featured image metabox.
*
* @param string $content Content in the featured image metabox.
* @param number $post_id Id of the post we are on.
*
* @return string Content for the featured image.
*/
function afi_metabox($content, $post_id)
{
wp_nonce_field('afi_metabox_' . $post_id, 'afi_metabox_nonce');
$image_url = get_post_meta($post_id, '_afi_img_src', true);
if (!$image_url) {
$post_thumbnail_id = get_post_thumbnail_id($post_id);
if ('' !== $post_thumbnail_id) {
$image_url = wp_get_attachment_url($post_thumbnail_id);
}
}
$content = '<div id="custom_image_container">';
if ($image_url) {
$content .= '<img src="' . $image_url . '" style="max-width:100%;" />';
}
$content .= '</div>';
// Add & remove image links.
$content .= '<p class="hide-if-no-js">';
$content .= '<a class="upload-custom-img ' . ($image_url ? 'hidden' : '') . '" href="#">';
$content .= __('Set custom image', 'tutsplus');
$content .= '</a>';
$content .= '<a class="delete-custom-img ' . (!$image_url ? 'hidden' : '') . '" href="#">';
$content .= __('Remove this image', 'tutsplus');
$content .= '</a>';
$content .= '</p>';
// Hidden input to set the chosen image url on post.
$content .= '<input class="afi-img-id" name="afi-img-src" type="hidden" value="' . esc_url($image_url) . '" />';
return $content;
}
开发者ID:manovotny,项目名称:advanced-featured-image,代码行数:36,代码来源:advanced-featured-image.php
示例15: sfc_media_find_images
function sfc_media_find_images($post, $content = '')
{
if (empty($content)) {
$content = apply_filters('the_content', $post->post_content);
}
$images = array();
// we get the post thumbnail, put it first in the image list
if (current_theme_supports('post-thumbnails') && has_post_thumbnail($post->ID)) {
$thumbid = get_post_thumbnail_id($post->ID);
$att = wp_get_attachment_image_src($thumbid, 'full');
if (!empty($att[0])) {
$images[] = $att[0];
}
}
if (is_attachment() && preg_match('!^image/!', get_post_mime_type($post))) {
$images[] = wp_get_attachment_url($post->ID);
}
// now search for images in the content itself
if (preg_match_all('/<img\\s+(.+?)>/i', $content, $matches)) {
foreach ($matches[1] as $match) {
foreach (wp_kses_hair($match, array('http')) as $attr) {
$img[strtolower($attr['name'])] = $attr['value'];
}
if (isset($img['src'])) {
if (!isset($img['class']) || isset($img['class']) && false === straipos($img['class'], apply_filters('sfc_img_exclude', array('wp-smiley')))) {
// ignore smilies
if (!in_array($img['src'], $images) && strpos($img['src'], 'fbcdn.net') === false && strpos($img['src'], '/plugins/') === false) {
$images[] = $img['src'];
}
}
}
}
}
return $images;
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:35,代码来源:sfc-media.php
示例16: get_image_url
function get_image_url()
{
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id, 'large');
$image_url = $image_url[0];
echo $image_url;
}
开发者ID:pallid,项目名称:Bodriy,代码行数:7,代码来源:functions.php
示例17: rt_social_media_share
/**
* Social Media Share Shortcode
*
* @global class $post
*
* @param array $atts
* @param string $content
* @return string $output
*/
function rt_social_media_share($atts = array(), $content = null)
{
global $post;
//Available Social Media Icons
$rt_social_share_list = apply_filters("rt_social_media_list", array("Email" => array("icon_name" => "mail", "url" => "mailto:?body=[URL]", "popup" => false), "Twitter" => array("icon_name" => "twitter", "url" => "http://twitter.com/home?status=[TITLE]+[URL]", "popup" => true), "Facebook" => array("icon_name" => "facebook", "url" => "http://www.facebook.com/sharer/sharer.php?u=[URL]&title=[TITLE]", "popup" => true), "Google +" => array("icon_name" => "gplus", "url" => "https://plus.google.com/share?url=[URL]", "popup" => true), "Pinterest" => array("icon_name" => "pinterest", "url" => "http://pinterest.com/pin/create/bookmarklet/?media=[MEDIA]&url=[URL]&is_video=false&description=[TITLE]", "popup" => true), "Tumblr" => array("icon_name" => "tumblr", "url" => "http://tumblr.com/share?url=[URL]&title=[TITLE]", "popup" => true), "Linkedin" => array("icon_name" => "linkedin", "url" => "http://www.linkedin.com/shareArticle?mini=true&url=[URL]&title=[TITLE]&source=", "popup" => true), "Vkontakte" => array("icon_name" => "vkontakte", "url" => "http://vkontakte.ru/share.php?url=[URL]", "popup" => true)));
$title = urlencode(get_the_title($post->ID));
$permalink = urlencode(get_the_permalink($post->ID));
$image = urlencode(rt_get_attachment_image_src(get_post_thumbnail_id($post->ID)));
$output = "";
foreach ($rt_social_share_list as $key => $value) {
$value["url"] = str_replace("[URL]", $permalink, $value["url"]);
$value["url"] = str_replace("[TITLE]", $title, $value["url"]);
$value["url"] = str_replace("[MEDIA]", $image, $value["url"]);
$output .= '<li class="' . $value["icon_name"] . '">';
$output .= $value["popup"] ? '<a class="icon-' . $value["icon_name"] . ' " href="#" data-url="' . $value["url"] . '" title="' . $key . '">' : '<a class="icon-' . $value["icon_name"] . ' " href="' . $value["url"] . '" title="' . $key . '">';
$output .= '<span>' . $key . '</span>';
$output .= '</a>';
$output .= '</li>';
}
return '
<div class="social_share_holder">
<div class="share_text"><span class="icon-share">' . __("Share", "rt_theme") . '</span></div>
<ul class="social_media">' . $output . '</ul>
</div>';
}
开发者ID:ryan-konkolewski,项目名称:rt-theme-19-extentions-multisite,代码行数:34,代码来源:rt_social_media_share.php
示例18: post_grid_get_media
function post_grid_get_media($media_source, $featured_img_size)
{
$html_thumb = '';
if ($media_source == 'featured_image') {
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $featured_img_size);
$thumb_url = $thumb['0'];
if (!empty($thumb_url)) {
$html_thumb .= '<img src="' . $thumb_url . '" />';
} else {
$html_thumb .= '';
}
} elseif ($media_source == 'empty_thumb') {
$html_thumb .= '<img src="' . post_grid_plugin_url . 'assets/frontend/css/images/placeholder.png" />';
} elseif ($media_source == 'first_image') {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
if (!empty($matches[1][0])) {
$first_img = $matches[1][0];
}
if (empty($first_img)) {
$html_thumb .= '';
} else {
$html_thumb .= '<img src="' . $first_img . '" />';
}
}
return $html_thumb;
}
开发者ID:brettratner,项目名称:TCNJ-IMM-Showcase-2016,代码行数:30,代码来源:functions.php
示例19: sys_recent_posts
function sys_recent_posts($atts, $content = null)
{
extract(shortcode_atts(array('limit' => '2', 'description' => '40', 'cat_id' => '23', 'thumb' => 'true', 'postdate' => ''), $atts));
$out = '<div class="widget_postslist sc">';
$out .= '<ul>';
global $wpdb;
$myposts = get_posts("numberposts={$limit}&offset=0&cat={$cat_id}");
foreach ($myposts as $post) {
$post_date = $post->post_date;
$post_date = mysql2date('F j, Y', $post_date, false);
$out .= "<li>";
if ($thumb == "true") {
$thumbid = get_post_thumbnail_id($post->ID);
$imgsrc = wp_get_attachment_image_src($thumbid, array(9999, 9999));
$out .= '<div class="thumb"><a href="' . get_permalink($post->ID) . '" title="' . $post->post_title . '">';
if ($thumbid) {
$out .= atp_resize('', $imgsrc['0'], '50', '50', 'imgborder', '');
} else {
//$out .= '<img class="imgborder" src="'.THEME_URI.'/images/no-image.jpg'.'" alt="' .$post->post_title. '" />';
}
$out .= '</a></div>';
}
$out .= '<div class="pdesc"><a href="' . get_permalink($post->ID) . '" rel="bookmark">' . $post->post_title . '</a>';
if ($postdate == "true") {
$out .= '<div class="w-postmeta"><span>' . $post_date . '</span></div>';
} else {
$out .= '<p>' . wp_html_excerpt($post->post_content, $description, '...') . '</p>';
}
$out .= '</div></li>';
}
$out .= '</ul></div>';
return $out;
wp_reset_query();
}
开发者ID:pryspry,项目名称:MusicPlay,代码行数:34,代码来源:recentposts.php
示例20: post_thumbnail_url
function post_thumbnail_url()
{
$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'full');
$thumb_url = $thumb_url_array[0];
echo $thumb_url;
}
开发者ID:kreapress,项目名称:jaechicks-site,代码行数:7,代码来源:pictures.php
注:本文中的get_post_thumbnail_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论