本文整理汇总了PHP中MultiPostThumbnails类的典型用法代码示例。如果您正苦于以下问题:PHP MultiPostThumbnails类的具体用法?PHP MultiPostThumbnails怎么用?PHP MultiPostThumbnails使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MultiPostThumbnails类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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();
?>
示例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>
示例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
}
示例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
}
}
示例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;
}
}
示例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>';
};
示例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();
?>
示例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">
示例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>
示例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();
示例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;
}
示例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') {