예제 #1
0
 /**
  * @ticket 12235
  */
 function test_get_the_post_thumbnail_caption_empty()
 {
     $post_id = self::factory()->post->create();
     $attachment_id = self::factory()->attachment->create_object('image.jpg', $post_id, array('post_mime_type' => 'image/jpeg', 'post_type' => 'attachment', 'post_excerpt' => ''));
     set_post_thumbnail($post_id, $attachment_id);
     $this->assertEquals('', get_the_post_thumbnail_caption($post_id));
 }
예제 #2
0
 function the_post_thumbnail_caption()
 {
     echo apply_filters('the_content', get_the_post_thumbnail_caption());
 }
예제 #3
0
 function ishyoboy_shortcode_featured_image($atts, $content = null)
 {
     $sc_atts = shortcode_atts(array('id' => '', 'css_class' => '', 'style' => '', 'tooltip' => '', 'tooltip_color' => '', 'align' => '', 'url' => '', 'show_caption' => 'yes', 'new_window' => 'no', 'open_full_version' => 'no', 'size' => 'theme-large'), $atts);
     $return = '';
     if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
         $return .= '<div class="featured-image';
         $return .= '' != $sc_atts['css_class'] ? ' ' . esc_attr($sc_atts['css_class']) : '';
         $return .= 'right' == $sc_atts['align'] ? ' right' : '';
         $return .= 'left' == $sc_atts['align'] ? ' left' : '';
         $return .= 'center' == $sc_atts['align'] ? ' center' : '';
         $return .= '' != $sc_atts['tooltip'] && '' != $sc_atts['tooltip_color'] ? ' tooltip-' . esc_attr($sc_atts['tooltip_color']) : '';
         $return .= '"';
         $return .= '' != $sc_atts['id'] ? ' id="' . esc_attr($sc_atts['id']) . '"' : '';
         $return .= '' != $sc_atts['style'] ? ' style="' . esc_attr($sc_atts['style']) . '"' : '';
         $return .= '' != $sc_atts['tooltip'] ? ' data-type="tooltip" title="' . esc_attr($sc_atts['tooltip']) . '"' : '';
         $return .= '>';
         if ('' != $sc_atts['url'] || 'yes' != $sc_atts['open_full_version']) {
             if ('yes' == $sc_atts['open_full_version']) {
                 $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
                 $return .= '<a href="' . esc_attr($large_image_url[0]) . '" alt=""' . ('yes' == esc_attr($sc_atts['new_window']) ? ' target="_blank"' : '') . '>';
             } else {
                 $return .= '<a href="' . esc_attr(apply_filters('ishyoboy_sc_url', $sc_atts['url'])) . '" alt=""' . ('yes' == esc_attr($sc_atts['new_window']) ? ' target="_blank"' : '') . '>';
             }
         }
         $return .= get_the_post_thumbnail(get_the_ID(), $sc_atts['size']);
         $return .= '' != $sc_atts['url'] || 'yes' != $sc_atts['open_full_version'] ? '</a>' : '';
         $return .= 'yes' == $sc_atts['show_caption'] ? '<div class="wp-caption"><p class="wp-caption-text">' . get_the_post_thumbnail_caption() . '</p></div>' : '';
         $return .= '</div>';
     }
     return $return;
 }
예제 #4
0
function the_post_thumbnail_caption()
{
    echo get_the_post_thumbnail_caption();
}
예제 #5
0
/**
 * Displays the post thumbnail caption.
 *
 * @since 4.6.0
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
 */
function the_post_thumbnail_caption($post = null)
{
    /**
     * Filters the displayed post thumbnail caption.
     *
     * @since 4.6.0
     *
     * @param string $caption Caption for the given attachment.
     */
    echo apply_filters('the_post_thumbnail_caption', get_the_post_thumbnail_caption($post));
}