本文整理汇总了PHP中MultiPostThumbnails类的典型用法代码示例。如果您正苦于以下问题:PHP MultiPostThumbnails类的具体用法?PHP MultiPostThumbnails怎么用?PHP MultiPostThumbnails使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MultiPostThumbnails类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_image_url
public function get_image_url($type, $post_id, $size = null)
{
if (class_exists('MultiPostThumbnails')) {
return \MultiPostThumbnails::get_post_thumbnail_url($this->id, $type, $post_id, $size);
}
return null;
}
开发者ID:grantnorwood,项目名称:SBXWP,代码行数:7,代码来源:CPT.php
示例2: widget
public function widget($args, $instance)
{
extract($args);
$title = $instance['title'];
echo $before_widget;
if (!empty($title)) {
echo '<h3 class="widget-title">' . $title . '</h3>';
}
echo class_exists('MultiPostThumbnails') ? MultiPostThumbnails::get_the_post_thumbnail(get_post_type(), 'flyer') : get_the_post_thumbnail();
echo $after_widget;
}
开发者ID:david-ievents,项目名称:iEvents.com-Dev,代码行数:11,代码来源:event.php
示例3: custom_image_directory
function custom_image_directory($path, $args)
{
if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail('post', 'twitter-image', $args['id'])) {
// get the image for Twitter
$imgid = MultiPostThumbnails::get_post_thumbnail_id('post', 'twitter-image', $args['id']);
$path = wp_get_attachment_url($imgid);
// Using amazon S3? Replace your S3 path with local path
$path = str_replace('http://brewbound-images.s3.amazonaws.com/', 'c:\\inetpub\\wp-brewbound\\', $path);
$path = str_replace('/', '\\', $path);
}
return $path;
}
开发者ID:joedolson,项目名称:plugin-extensions,代码行数:12,代码来源:multipostthumbnails.php
示例4: post_class
post_class();
?>
>
<header class="entry-header">
<!-- Display featured image in right-aligned floating div -->
<div class="studentPhoto">
<a href="<?php
the_permalink();
?>
" title="<?php
echo esc_attr(sprintf(__('Permalink to %s', 'twentytwelve'), the_title_attribute('echo=0')));
?>
" rel="bookmark"><?php
if (class_exists('MultiPostThumbnails')) {
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image');
}
?>
</a>
</div>
<!-- Display Title and Author Name -->
<strong>Title: </strong><a href="<?php
the_permalink();
?>
" title="<?php
echo esc_attr(sprintf(__('Permalink to %s', 'twentytwelve'), the_title_attribute('echo=0')));
?>
" rel="bookmark"><?php
the_title();
?>
开发者ID:burbridge,项目名称:thesis2013website,代码行数:31,代码来源:single-student-loop.php
示例5: get_post_meta
} else {
echo 'span_12';
}
?>
">
<?php
if (!post_password_required()) {
$video_embed = get_post_meta($post->ID, '_nectar_video_embed', true);
$video_m4v = get_post_meta($post->ID, '_nectar_video_m4v', true);
$video_ogv = get_post_meta($post->ID, '_nectar_video_ogv', true);
$video_poster = get_post_meta($post->ID, '_nectar_video_poster', true);
//Gallery
if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'second-slide') || !empty($enable_gallery_slider) && $enable_gallery_slider == 'on') {
if (floatval(get_bloginfo('version')) < "3.6") {
if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'second-slide')) {
nectar_gallery($post->ID);
}
} else {
if (!empty($enable_gallery_slider) && $enable_gallery_slider == 'on') {
$gallery_ids = grab_ids_from_gallery();
?>
<div class="flex-gallery">
<ul class="slides">
<?php
foreach ($gallery_ids as $image_id) {
echo '<li>' . wp_get_attachment_image($image_id, '', false) . '</li>';
}
?>
</ul>
开发者ID:ryuqing,项目名称:cake,代码行数:31,代码来源:single-portfolio.php
示例6:
}
?>
<p class="summary"><?php
echo $business_1_summary;
?>
</p>
<div class="sold-text">
<p><?php
echo $sold_text;
?>
</p>
</div>
<?php
if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'secondary-image', null)) {
?>
<?php
get_template_part('includes/post-formats/tombstone-secondary-logo');
?>
<?php
} else {
?>
<div class="business-logo business-name">
<span><?php
echo $business_2_name;
?>
</span>
</div>
<?php
}
开发者ID:AdrianBav,项目名称:oilandgas,代码行数:31,代码来源:tombstone.php
示例7: while
<section class="level-2">
<div class="row">
<div class="medium-8 columns package-category-listing ">
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<h1><?php
the_title();
?>
</h1>
<?php
if (class_exists('MultiPostThumbnails')) {
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'landing-page-image');
}
?>
<div class="package-intro"><?php
the_content();
?>
</div>
<p><?php
edit_post_link();
?>
</p>
<hr>
<?php
}
}
开发者ID:roachdesign,项目名称:Italy-Source-Wordpress,代码行数:30,代码来源:package.php
示例8: kite_get_secondary_background_image
function kite_get_secondary_background_image($default)
{
if (class_exists('MultiPostThumbnails')) {
if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'background-image')) {
return MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'background-image');
} else {
return $default;
}
} else {
return $default;
}
}
开发者ID:s4mobile,项目名称:WordPressTech,代码行数:12,代码来源:functions.php
示例9: team_list
function team_list($atts) {
global $meta_box;
$q = new WP_Query(array(
'post_type' => 'team',
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => -1, // = all of 'em
));
echo '<div id="team-grid">';
echo '<div class="row">';
foreach ($q->posts as $item) {
$team_title = get_post_meta( $item->ID, 'team_title', true );
$photo = wp_get_attachment_image_src( get_post_thumbnail_id( $item->ID ), 'single-post-thumbnail' );
$thumb = wp_get_attachment_image_src( MultiPostThumbnails::get_post_thumbnail_id('team', 'secondary-image', $item->ID), 'single-post-thumbnail' );
list($width, $height) = getimagesize($_SERVER[DOCUMENT_ROOT].$thumb[0]);
//echo grid element
if ($width == 410) {
echo '<div class="span4">';
} else {
echo '<div class="span2">';
}
echo '<figure>';
echo '<a class="no-ajaxy" data-toggle="modal" href="#' . $item->post_name . '" >';
echo '<img src="'.$thumb[0].'" alt="' .$item->post_title. 's">';
echo '<figcaption>';
echo $item->post_title;
echo '<br>';
echo '<i>'.$team_title.'</sup></i>';
echo '</figcaption>';
echo '<span class="view-bio">View Bio <i class="icon-chevron-right"></i></span>';
echo '<span class="team-overlay"></span>';
echo '</a>';
echo '</figure>';
echo '</div>';
//echo modal
echo '<div class="modal fade" id="' . $item->post_name . '">';
echo '<div class="modal-body">';
echo '<div class="row">';
echo '<div class="span4">';
echo '<img src="'.$photo[0].'" alt="' .$item->post_title. 's">';
echo '</div>';
echo '<div class="span8">';
echo '<a class="close no-ajaxy" data-dismiss="modal">X</a>';
echo '<h1>'.$item->post_title.', <small><i>'.$team_title.'</i></small></h1>';
echo '<div class="scroll-pane">';
echo apply_filters( 'the_content' , $item->post_content );
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
echo '</div>';
echo '</div>';
};
开发者ID:ndimatteo,项目名称:marmaras,代码行数:64,代码来源:roots-custom.php
示例10: while
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
}
the_content();
}
?>
</p>
</div>
</div>
<div class="col-md-3">
<?php
add_image_size('custom-size', 263, 263);
if (class_exists('MultiPostThumbnails')) {
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'feature-image-2', NULL, 'custom-size');
}
?>
</div>
</div>
</section>
<section class="why">
<div class="container">
<div class="row" style="border-bottom:1px dotted #ccc">
<?php
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$wp_query = new WP_Query(array('post_type' => 'post', 'showposts' => '8', 'paged' => $paged, 'order' => 'ASC'));
if ($wp_query->have_posts()) {
while ($wp_query->have_posts()) {
$wp_query->the_post();
?>
开发者ID:rajadileepkumar,项目名称:travels,代码行数:31,代码来源:index.php
示例11: nectar_recent_posts
//.........这里部分代码省略.........
}
}
// endif for if there's a video
}
// endif for 3.6
} else {
if (get_post_format() == 'audio') {
?>
<div class="audio-wrap">
<?php
if ($wp_version < "3.6") {
nectar_audio($post->ID);
} else {
$audio_mp3 = get_post_meta($post->ID, '_nectar_audio_mp3', true);
$audio_ogg = get_post_meta($post->ID, '_nectar_audio_ogg', true);
if (!empty($audio_ogg) || !empty($audio_mp3)) {
$audio_output = '[audio ';
if (!empty($audio_mp3)) {
$audio_output .= 'mp3="' . $audio_mp3 . '" ';
}
if (!empty($audio_ogg)) {
$audio_output .= 'ogg="' . $audio_ogg . '"';
}
$audio_output .= ']';
echo do_shortcode($audio_output);
}
}
?>
</div><!--/audio-wrap-->
<?php
} else {
if (get_post_format() == 'gallery') {
if ($wp_version < "3.6") {
if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'second-slide')) {
nectar_gallery($post->ID);
} else {
if (has_post_thumbnail()) {
echo get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => ''));
}
}
} else {
$gallery_ids = grab_ids_from_gallery();
?>
<div class="flex-gallery">
<ul class="slides">
<?php
foreach ($gallery_ids as $image_id) {
echo '<li>' . wp_get_attachment_image($image_id, 'portfolio-thumb', false) . '</li>';
}
?>
</ul>
</div><!--/gallery-->
<?php
}
} else {
if (has_post_thumbnail()) {
echo '<a href="' . get_permalink() . '">' . get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => '')) . '</a>';
}
}
}
}
?>
<div class="post-header">
开发者ID:nignjatov,项目名称:TaxiDev,代码行数:67,代码来源:shortcode-processing.php
示例12: get_header
<?php
/**
* The template for displaying all single posts and attachments
*
* @package WordPress
* @subpackage Twenty_Sixteen
* @since Twenty Sixteen 1.0
*/
get_header();
the_post();
$slider = MultiPostThumbnails::get_post_thumbnail_id('pelicula', 'interior', $post->ID);
$slider = wp_get_attachment_image_src($slider, 'full');
$anio = get_post_meta($post->ID, "wpcf-ano-de-estreno", true);
$stars = get_post_meta($post->ID, "wpcf-calificacion", true);
?>
<section class="w-clearfix content">
<div class="moviecontent">
<div class="w-clearfix c960">
<div class="w-clearfix peliculasrecientes">
<h1 class="titlesection"><?php
the_title();
?>
</h1>
<div class="pordagrande" style="background-image: url('<?php
echo $slider[0];
?>
')"></div>
<div class="w-clearfix descripcionpeli">
<div class="w-clearfix des">
<h1 class="titlesection titleinfo">Resumen</h1>
开发者ID:calderontech,项目名称:naddco,代码行数:31,代码来源:single.php
示例13:
</div>
<div class="container">
<div class="row">
<div class="main-container flex flex-column flex-j-center">
<div class="single-image flex flex-j-center">
<?php
if (class_exists('MultiPostThumbnails')) {
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'feature-image-3');
}
?>
</div>
<div class="main-container flex flex-j-center">
<div class="single-image flex flex-j-center">
<?php
if (class_exists('MultiPostThumbnails')) {
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'feature-image-4');
}
?>
</div>
</div>
</div>
</div>
<div class="page-links flex flex-j-between flex-j-end">
<div class="previous">
<?php
previous_post_link();
?>
</div>
<div class="next">
<?php
next_post_link();
开发者ID:eursula,项目名称:portfolio,代码行数:31,代码来源:single.php
示例14: get_thumbnail_image_src
/**
* Retrieve the source of an image added through multiple post thumbnails.
*
* @param string $type Type of thumbnail being requested.
* @param string $size Size of thumbnail being requested.
*
* @return bool|string URL of the image if available. False if not.
*/
public function get_thumbnail_image_src($type, $size = null)
{
if (class_exists('MultiPostThumbnails')) {
return MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), $type, get_the_ID(), $size);
}
return false;
}
开发者ID:natejacobson,项目名称:WSUWP-spine-parent-theme,代码行数:15,代码来源:theme-images.php
示例15: get_header
*/
get_header();
?>
<?php
$pages = unserialize(get_option('parallax_page_list', true));
$p_count = count($pages);
if (is_array($pages) && !empty($pages)) {
foreach ($pages as $ids) {
$content_post = get_post($ids);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$color = get_post_meta($ids, 'pbgcolor', true);
$paraanimate = get_post_meta($ids, 'parallax_animate', true);
$paraoverlay = get_post_meta($ids, 'parallax_overlay', true);
$custom = MultiPostThumbnails::get_post_thumbnail_id('page', 'parallax-image', $ids);
$custom = wp_get_attachment_image_src($custom, 'parallax-image');
$url = $custom[0];
$back_status = get_post_meta($ids, 'backgroud_status', true);
$back = '';
if ($url != '') {
$back = $url;
} else {
$back = '';
}
$animate = '';
if ($paraanimate == 'yes') {
$animate = 'animation: animatedBackground 80s linear infinite;-ms-animation: animatedBackground 80s linear infinite;-moz-animation: animatedBackground 80s linear infinite;-webkit-animation: animatedBackground 80s linear infinite;background-attachment: fixed;';
}
$overlay = '';
if ($paraoverlay == 'yes') {
开发者ID:StudioCreate,项目名称:Uncle-Hummer-WordPress-Theme,代码行数:31,代码来源:front-page.php
示例16: thumbnail_meta_box_modal
//.........这里部分代码省略.........
}
options = {
title: title,
library: {
type: 'image'
}
};
thumbnailId = $thumbnailId.val();
if ( '' !== thumbnailId && -1 !== thumbnailId )
options.selection = [ Attachment.get( thumbnailId ) ];
frame = wp.media( options );
frame.toolbar.on( 'activate:select', function() {
frame.toolbar.view().set({
select: {
style: 'primary',
text: update,
click: function() {
var selection = frame.state().get('selection'),
model = selection.first(),
sizes = model.get('sizes'),
size;
setMPTImage( model.id );
// @todo: might need a size hierarchy equivalent.
if ( sizes )
size = sizes['<?php
echo esc_js("{$this->post_type}-{$this->id}-thumbnail");
?>
'] || sizes['post-thumbnail'] || sizes.medium;
// @todo: Need a better way of accessing full size
// data besides just calling toJSON().
size = size || model.toJSON();
frame.close();
$( '<img />', {
src: size.url,
width: size.width
}).prependTo( $element );
}
}
});
});
});
$element.on( 'click', '.remove', function( event ) {
event.preventDefault();
setMPTImage( -1 );
});
});
</script>
<?php
$thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id($this->post_type, $this->id, $post->ID);
$thumbnail_size = isset($_wp_additional_image_sizes["{$this->prefix}-thumbnail"]) ? "{$this->prefix}-thumbnail" : 'medium';
$thumbnail_html = wp_get_attachment_image($thumbnail_id, $thumbnail_size);
$classes = empty($thumbnail_id) ? '' : 'has-featured-image';
?>
<div id="select-mpt-<?php
echo esc_attr($this->prefix);
?>
"
class="<?php
echo esc_attr($classes);
?>
"
data-post-id="<?php
echo esc_attr($post->ID);
?>
">
<?php
echo $thumbnail_html;
?>
<input type="hidden" name="<?php
echo esc_js($this->prefix);
?>
-thumbnail_id" value="<?php
echo esc_attr($thumbnail_id);
?>
" />
<a href="#" class="choose button-secondary">Choose a <?php
echo esc_html($this->label);
?>
</a>
<a href="#" class="remove">Remove <?php
echo esc_html($this->label);
?>
</a>
</div>
<?php
}
开发者ID:besimhu,项目名称:legacy,代码行数:101,代码来源:multi-post-thumbnails.php
示例17: get_extra_images
function get_extra_images()
{
global $post, $wp_query;
$extra_images_no = get_option("extra_images_no");
$post_ID = $post->ID;
if ($extra_images_no == "") {
$extra_images_no = 4;
}
$postFormat = get_post_format($post->ID);
$page_template = get_page_template();
$path = pathinfo($page_template);
$page_template = $path['filename'];
$post_extra_images = array();
//$post_captions = array();
$post_type = get_post_type($post->ID);
for ($i = 1; $i <= $extra_images_no; $i++) {
if (get_post_meta($post_ID, "background_image", true) != "extra-image-" . $i) {
if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail($post_type, "extra-image-" . $i . "")) {
$image_id = MultiPostThumbnails::get_post_thumbnail_id($post_type, "extra-image-" . $i . "", $post_ID);
$image_feature_url = wp_get_attachment_image_src($image_id, "thumbnail");
//$post_extra_images[] = $image_feature_url[0];
$post_extra_images .= '<img src="' . $image_feature_url[0] . '" alt="' . get_post_field('post_excerpt', $image_id) . '" />';
print '<img src="' . $image_feature_url[0] . '" alt="' . get_post_field('post_excerpt', $image_id) . '" />';
//$image_thumb_url = wp_get_attachment_image_src( $image_id, "thumbnail" );
//$post_extra_thumb_images[] = $image_thumb_url[0];
//$post_captions[$i-1] = get_post_field('post_excerpt', $image_id);
}
}
}
}
开发者ID:Bolixe,项目名称:Wordpress,代码行数:30,代码来源:functions.php
示例18: memberlite_getBannerImageID
function memberlite_getBannerImageID($post = NULL)
{
global $memberlite_defaults;
$memberlite_loop_images = get_theme_mod('memberlite_loop_images', $memberlite_defaults['memberlite_loop_images']);
if (in_the_loop() && ($memberlite_loop_images == 'show_both' || $memberlite_loop_images == 'show_banner') || is_single() || is_home() || is_page() && !is_page_template('templates/landing.php')) {
if (class_exists('MultiPostThumbnails')) {
//The Banner Image meta box is available
$thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id($post->post_type, 'memberlite_banner_image' . $post->post_type, $post->ID);
}
if (!empty($thumbnail_id)) {
//Use Banner Image as banner
return $thumbnail_id;
} else {
$memberlite_show_image_banner = get_post_meta($post->ID, 'memberlite_show_image_banner', true);
if (!empty($memberlite_show_image_banner) || in_the_loop()) {
//Use Featured Image as banner
$thumbnail_id = get_post_thumbnail_id($post->ID);
return $thumbnail_id;
} else {
return false;
}
}
} else {
return false;
}
}
开发者ID:greathmaster,项目名称:memberlite,代码行数:26,代码来源:extras.php
示例19: wp_get_attachment_image_src
<?php
$large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" alt="" class="tx-colorbox">';
the_post_thumbnail('imax-single-thumb');
echo '</a>';
if (class_exists('MultiPostThumbnails')) {
$large_image_url1 = wp_get_attachment_image_src(MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'feature-image-2', $post->ID), 'large');
if ($large_image_url1) {
echo '<a href="' . $large_image_url1[0] . '" title="' . the_title_attribute('echo=0') . '" class="tx-colorbox">';
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'feature-image-2', NULL, 'imax-single-thumb');
echo '</a>';
}
$large_image_url2 = wp_get_attachment_image_src(MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'feature-image-3', $post->ID), 'large');
if ($large_image_url2) {
echo '<a href="' . $large_image_url2[0] . '" title="' . the_title_attribute('echo=0') . '" class="tx-colorbox">';
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'feature-image-3', NULL, 'imax-single-thumb');
echo '</a>';
}
}
?>
</div>
</header><!-- .entry-header -->
<?php
}
?>
<div class="folio-meta">
<?php
if (!empty($sub_title)) {
?>
开发者ID:IlhamFS,项目名称:wordpress,代码行数:31,代码来源:single-portfolio.php
示例20:
?>
<figcaption>
<?php
if (dynamic_sidebar('featured-center')) {
}
?>
</figcaption>
</figure>
</article>
<article class="featured-content col-xs-12 col-md-4 col-lg-3 first">
<figure class="featured-img">
<?php
if (class_exists('MultiPostThumbnails')) {
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'third-featured-image');
}
?>
<figcaption>
<?php
if (dynamic_sidebar('featured-right')) {
}
?>
</figcaption>
</figure>
</article>
</div>
</div> <!-- .index-content .col-xs-12 -->
<?php
开发者ID:rdeco,项目名称:scattered_dreams,代码行数:31,代码来源:front-page.php
注:本文中的MultiPostThumbnails类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论