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


PHP gdlr_get_image函数代码示例

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


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

示例1: widget

 function widget($args, $instance)
 {
     global $theme_option;
     $title = apply_filters('widget_title', $instance['title']);
     $category = $instance['category'];
     $thumbnail_size = $instance['thumbnail_size'];
     // Opening of widget
     echo $args['before_widget'];
     // Open of title tag
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // Widget Content
     $player = get_posts(array('suppress_filters' => 0, 'name' => $category, 'post_type' => 'player', 'post_status' => 'publish', 'numberposts' => 1));
     $player_val = gdlr_lms_decode_preventslashes(get_post_meta($player[0]->ID, 'gdlr-soccer-player-settings', true));
     $player_options = empty($player_val) ? array() : json_decode($player_val, true);
     echo '<div class="feature-player-widget-wrapper">';
     echo '<div class="feature-player-widget-thumbnail">';
     echo gdlr_get_image(get_post_thumbnail_id($player[0]->ID), $thumbnail_size, true);
     echo '</div>';
     echo '<div class="feature-player-widget-title-wrapper">';
     echo '<h4 class="feature-player-widget-title">' . $player[0]->post_title . '</h4>';
     echo '<div class="feature-player-widget-position">';
     echo '<span class="gdlr-soccer-player-squad" >' . $player_options['player-info']['squad'] . '</span>';
     echo $player_options['player-info']['position'];
     echo '</div>';
     echo '</div>';
     // feature-player-widget-title
     echo '<div class="feature-player-widget-info-wrapper">';
     if (!empty($player_options['player-info']['games-played']) || $player_options['player-info']['games-played'] === "0") {
         echo '<div class="feature-player-widget-info">';
         echo '<span class="gdlr-head">' . $player_options['player-info']['games-played'] . '</span>';
         echo '<span class="gdlr-tail">' . __('Games Played', 'gdlr_translate') . '</span>';
         echo '</div>';
     }
     if (!empty($player_options['player-stats']['goals']) || $player_options['player-stats']['goals'] === "0") {
         echo '<div class="feature-player-widget-info">';
         echo '<span class="gdlr-head">' . $player_options['player-stats']['goals'] . '</span>';
         echo '<span class="gdlr-tail">' . __('Goals', 'gdlr_translate') . '</span>';
         echo '</div>';
     }
     if (!empty($player_options['player-stats']['assists']) || $player_options['player-stats']['assists'] === "0") {
         echo '<div class="feature-player-widget-info">';
         echo '<span class="gdlr-head">' . $player_options['player-stats']['assists'] . '</span>';
         echo '<span class="gdlr-tail">' . __('Assists', 'gdlr_translate') . '</span>';
         echo '</div>';
     }
     echo '</div>';
     // feature-player-widget-info
     echo '<a class="feature-player-widget-link gdlr-button with-border" href="' . get_permalink($player[0]->ID) . '" >' . __('View Profile & Stats', 'gdlr_translate') . '</a>';
     echo '</div>';
     // feature-player-widget-wrapper
     // Closing of widget
     echo $args['after_widget'];
 }
开发者ID:kelscahill,项目名称:Northeast-Pride,代码行数:55,代码来源:featured-player-widget.php

示例2: widget

 function widget($args, $instance)
 {
     global $theme_option;
     $title = apply_filters('widget_title', $instance['title']);
     $category = $instance['category'];
     $num_fetch = $instance['num_fetch'];
     // Opening of widget
     echo $args['before_widget'];
     // Open of title tag
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // Widget Content
     $current_post = array(get_the_ID());
     $query_args = array('post_type' => 'post', 'suppress_filters' => false);
     $query_args['posts_per_page'] = $num_fetch;
     $query_args['orderby'] = 'comment_count';
     $query_args['order'] = 'desc';
     $query_args['paged'] = 1;
     $query_args['category_name'] = $category;
     $query_args['ignore_sticky_posts'] = 1;
     $query_args['post__not_in'] = array(get_the_ID());
     $query = new WP_Query($query_args);
     if ($query->have_posts()) {
         echo '<div class="gdlr-recent-post-widget">';
         while ($query->have_posts()) {
             $query->the_post();
             echo '<div class="recent-post-widget">';
             $thumbnail = gdlr_get_image(get_post_thumbnail_id(), 'thumbnail');
             if (!empty($thumbnail)) {
                 echo '<div class="recent-post-widget-thumbnail"><a href="' . get_permalink() . '" >' . $thumbnail . '</a></div>';
             }
             echo '<div class="recent-post-widget-content">';
             echo '<div class="recent-post-widget-title"><a href="' . get_permalink() . '" >' . get_the_title() . '</a></div>';
             echo '<div class="recent-post-widget-info">';
             echo '<div class="blog-info blog-comment">';
             echo '<i class="icon-comment"></i>';
             comments_popup_link(__('0 Comment', 'gdlr_translate'), __('1 Comment', 'gdlr_translate'), __('% Comments', 'gdlr_translate'), '', __('Comments are Off', 'gdlr_translate'));
             echo '</div>';
             // blog-info
             echo '</div>';
             // recent-post-widget-info
             echo '</div>';
             // recent-post-widget-content
             echo '<div class="clear"></div>';
             echo '</div>';
             // recent-post-widget
         }
         echo '<div class="clear"></div>';
         echo '</div>';
     }
     wp_reset_postdata();
     // Closing of widget
     echo $args['after_widget'];
 }
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:55,代码来源:popular-post-widget.php

示例3: widget

 function widget($args, $instance)
 {
     global $theme_option;
     $title = apply_filters('widget_title', $instance['title']);
     $category = $instance['category'];
     $num_fetch = $instance['num_fetch'];
     $thumbnail_size = $instance['thumbnail_size'];
     // Opening of widget
     echo $args['before_widget'];
     // Open of title tag
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // Widget Content
     $current_post = array(get_the_ID());
     $query_args = array('post_type' => 'portfolio', 'suppress_filters' => false);
     $query_args['posts_per_page'] = $num_fetch;
     $query_args['orderby'] = 'post_date';
     $query_args['order'] = 'desc';
     $query_args['paged'] = 1;
     $query_args['portfolio_category'] = $category;
     $query_args['ignore_sticky_posts'] = 1;
     $query_args['post__not_in'] = array(get_the_ID());
     $query = new WP_Query($query_args);
     if ($query->have_posts()) {
         echo '<div class="gdlr-post-slider-widget">';
         echo '<div class="flexslider" >';
         echo '<ul class="slides" >';
         while ($query->have_posts()) {
             $query->the_post();
             $image_id = get_post_thumbnail_id();
             if (!empty($image_id)) {
                 echo '<li>';
                 echo '<a href="' . get_permalink() . '" >';
                 echo gdlr_get_image($image_id, $thumbnail_size);
                 echo '<div class="gdlr-caption-wrapper post-slider">';
                 echo '<div class="gdlr-caption-title">';
                 echo get_the_title();
                 echo '</div>';
                 // gdlr-caption-title
                 echo '</div>';
                 // gdlr-caption-wrapper
                 echo '</a>';
                 echo '</li>';
             }
         }
         echo '</ul>';
         echo '</div>';
         echo '</div>';
         // gdlr-post-slider-widget
     }
     wp_reset_postdata();
     // Closing of widget
     echo $args['after_widget'];
 }
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:55,代码来源:port-slider-widget.php

示例4: gdlr_soccer_get_player_avatar

function gdlr_soccer_get_player_avatar($size = 'thumbnail', $link = true)
{
    if (function_exists('gdlr_get_image')) {
        if (is_single() && $link) {
            return '<div class="gdlr-soccer-player-thumbnail">' . gdlr_get_image(get_post_thumbnail_id(), $size, true) . '</div>';
        } else {
            return '<div class="gdlr-soccer-player-thumbnail">' . gdlr_get_image(get_post_thumbnail_id(), $size, array('url' => get_permalink())) . '</div>';
        }
    }
    return '';
}
开发者ID:kelscahill,项目名称:Northeast-Pride,代码行数:11,代码来源:player-item.php

示例5: gdlr_get_session_thumbnail

function gdlr_get_session_thumbnail($size = 'thumbnail')
{
    $image_id = get_post_thumbnail_id();
    if (!empty($image_id)) {
        if (is_single()) {
            return '<div class="gdlr-session-thumbnail">' . gdlr_get_image($image_id, $size, true) . '</div>';
        } else {
            $ret = '<div class="gdlr-session-thumbnail"><a href="' . get_permalink() . '" >';
            $ret .= gdlr_get_image($image_id, $size);
            $ret .= '</a></div>';
            return $ret;
        }
    }
    return '';
}
开发者ID:eugene-gromky-co,项目名称:mindfulnesssummit,代码行数:15,代码来源:session-item.php

示例6: widget

 function widget($args, $instance)
 {
     global $theme_option;
     $title = apply_filters('widget_title', $instance['title']);
     $category = $instance['category'];
     $num_fetch = $instance['num_fetch'];
     // Opening of widget
     echo $args['before_widget'];
     // Open of title tag
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // Widget Content
     $current_post = array(get_the_ID());
     $query_args = array('post_type' => 'cause', 'suppress_filters' => false);
     $query_args['posts_per_page'] = $num_fetch;
     $query_args['orderby'] = 'post_date';
     $query_args['order'] = 'desc';
     $query_args['paged'] = 1;
     $query_args['cause_category'] = $category;
     $query_args['ignore_sticky_posts'] = 1;
     $query_args['post__not_in'] = array(get_the_ID());
     $query = new WP_Query($query_args);
     if ($query->have_posts()) {
         echo '<div class="gdlr-recent-post-widget">';
         while ($query->have_posts()) {
             $query->the_post();
             echo '<div class="recent-post-widget">';
             $thumbnail = gdlr_get_image(get_post_thumbnail_id(), 'thumbnail');
             $cause_option = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'post-option', true)), true);
             if (!empty($thumbnail)) {
                 echo '<div class="recent-post-widget-thumbnail"><a href="' . get_permalink() . '" >' . $thumbnail . '</a></div>';
             }
             echo '<div class="recent-post-widget-content">';
             echo '<div class="recent-post-widget-title"><a href="' . get_permalink() . '" ><span class="causeWidgetLink">' . get_the_title() . '</span></a></div>';
             echo gdlr_cause_donation_amount($cause_option['goal-of-donation'], $cause_option['current-funding']);
             echo '<p>' . substr(get_the_excerpt(), 0, 90) . '...</p>';
             echo '</div>';
             echo '<div class="clear"></div>';
             echo '</div>';
         }
         echo '<div class="clear"></div>';
         echo '</div>';
     }
     wp_reset_postdata();
     // Closing of widget
     echo $args['after_widget'];
 }
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:48,代码来源:recent-cause-widget.php

示例7: gdlr_get_cause_thumbnail

 function gdlr_get_cause_thumbnail($size = 'full')
 {
     $ret = '';
     $image_id = get_post_thumbnail_id();
     if (!empty($image_id)) {
         $ret = '<div class="gdlr-cause-thumbnail" >';
         if (is_single()) {
             $ret .= gdlr_get_image($image_id, $size);
         } else {
             $ret .= '<a href="' . get_permalink() . '" >';
             $ret .= gdlr_get_image($image_id, $size);
             $ret .= '</a>';
         }
         $ret .= '</div>';
     }
     return $ret;
 }
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:17,代码来源:gdlr-cause-item.php

示例8: widget

 function widget($args, $instance)
 {
     global $theme_option;
     $title = apply_filters('widget_title', $instance['title']);
     $category = $instance['category'];
     $num_fetch = $instance['num_fetch'];
     // Opening of widget
     echo $args['before_widget'];
     // Open of title tag
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // Widget Content
     $current_post = array(get_the_ID());
     $query_args = array('post_type' => 'portfolio', 'suppress_filters' => false);
     $query_args['posts_per_page'] = $num_fetch;
     $query_args['orderby'] = 'post_date';
     $query_args['order'] = 'desc';
     $query_args['paged'] = 1;
     $query_args['portfolio_category'] = $category;
     $query_args['post__not_in'] = array(get_the_ID());
     $query = new WP_Query($query_args);
     if ($query->have_posts()) {
         echo '<div class="gdlr-recent-port-widget">';
         while ($query->have_posts()) {
             $query->the_post();
             echo '<div class="recent-post-widget">';
             $thumbnail = gdlr_get_image(get_post_thumbnail_id(), 'thumbnail');
             if (!empty($thumbnail)) {
                 echo '<div class="recent-post-widget-thumbnail"><a href="' . get_permalink() . '" >' . $thumbnail . '</a></div>';
             }
             echo '<div class="recent-post-widget-content">';
             echo '<div class="recent-post-widget-title"><a href="' . get_permalink() . '" >' . get_the_title() . '</a></div>';
             echo '<div class="recent-post-widget-info">' . gdlr_get_blog_info(array('date'), false) . '</div>';
             echo '</div>';
             echo '<div class="clear"></div>';
             echo '</div>';
         }
         echo '<div class="clear"></div>';
         echo '</div>';
     }
     wp_reset_postdata();
     // Closing of widget
     echo $args['after_widget'];
 }
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:45,代码来源:recent-port-widget.php

示例9: gdlr_get_gallery_thumbnail

 function gdlr_get_gallery_thumbnail($settings)
 {
     $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
     global $gdlr_spaces;
     $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
     $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
     $ret = '<div class="gdlr-gallery-item gdlr-item gdlr-gallery-thumbnail" ' . $item_id . $margin_style . '>';
     // full image
     $ret .= '<div class="gdlr-gallery-thumbnail-container">';
     foreach ($settings['slider'] as $slide_id => $slide) {
         $ret .= '<div class="gdlr-gallery-thumbnail" data-id="' . $slide_id . '" >';
         $ret .= gdlr_get_image($slide_id);
         if ($settings['show-caption'] != 'no') {
             $ret .= '<div class="gallery-caption-wrapper">';
             $ret .= '<span class="gallery-caption">';
             $ret .= gdlr_get_attachment_info($slide_id, 'caption');
             $ret .= '</span>';
             $ret .= '</div>';
         }
         $ret .= '</div>';
     }
     $ret .= '</div>';
     // start printing gallery
     $current_size = 0;
     foreach ($settings['slider'] as $slide_id => $slide) {
         if (!empty($current_size) && $current_size % $settings['gallery-columns'] == 0) {
             $ret .= '<div class="clear"></div>';
         }
         $ret .= '<div class="gallery-column ' . gdlr_get_column_class('1/' . $settings['gallery-columns']) . '">';
         $ret .= '<div class="gallery-item" data-id="' . $slide_id . '" >';
         $ret .= gdlr_get_image($slide_id, $settings['thumbnail-size']);
         $ret .= '</div>';
         // gallery item
         $ret .= '</div>';
         // gallery column
         $current_size++;
     }
     $ret .= '<div class="clear"></div>';
     $ret .= '</div>';
     // gdlr-gallery-item
     return $ret;
 }
开发者ID:refazul-refat,项目名称:bcc,代码行数:42,代码来源:gdlr-media.php

示例10: gdlr_get_modern_page_list

 function gdlr_get_modern_page_list($query, $size, $thumbnail_size, $layout = 'fitRows')
 {
     $current_size = 0;
     $ret = '<div class="gdlr-isotope" data-type="portfolio" data-layout="' . $layout . '" >';
     while ($query->have_posts()) {
         $query->the_post();
         if ($current_size % $size == 0) {
             $ret .= '<div class="clear"></div>';
         }
         $ret .= '<div class="' . gdlr_get_column_class('1/' . $size) . '">';
         $ret .= '<div class="gdlr-item gdlr-portfolio-item gdlr-modern-portfolio">';
         // overlay
         $ret .= '<div class="portfolio-thumbnail gdlr-image">';
         $ret .= gdlr_get_image(get_post_thumbnail_id(), $thumbnail_size);
         $ret .= '<a class="portfolio-overlay-wrapper" href="' . get_permalink() . '" >';
         $ret .= '<span class="portfolio-overlay" >';
         $ret .= '<span class="portfolio-icon" ><i class="icon-link" ></i></span>';
         $ret .= '</span>';
         $ret .= '<div class="portfolio-thumbnail-bar"></div>';
         $ret .= '</a>';
         // content
         $ret .= '<div class="portfolio-content-wrapper">';
         $ret .= '<div class="portfolio-content-overlay"></div>';
         $ret .= '<h3 class="portfolio-title"><a href="' . get_permalink() . '" >' . get_the_title() . '</a></h3>';
         $ret .= '</div>';
         // portfolio-content-wrapper
         $ret .= '</div>';
         // portfolio-thumbnail
         $ret .= '</div>';
         // gdlr-item
         $ret .= '</div>';
         // column class
         $current_size++;
     }
     $ret .= '</div>';
     wp_reset_postdata();
     return $ret;
 }
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:38,代码来源:gdlr-page-item.php

示例11: gdlr_get_image

            echo gdlr_get_image($theme_option['logo-id']);
        }
    } else {
        if (empty($theme_option['logo-id'])) {
            $theme_option['logo-id'] = GDLR_PATH . '/images/logo.png';
        } else {
            if (is_numeric($theme_option['logo-id'])) {
                $image_src = wp_get_attachment_image_src($theme_option['logo-id'], 'full');
                $theme_option['logo-id'] = $image_src[0];
            }
        }
        $attr = ' data-normal="' . $theme_option['logo-id'] . '" ';
        if (empty($theme_option['logot-id'])) {
            echo gdlr_get_image(GDLR_PATH . '/images/logot.png', 'full', array(), $attr);
        } else {
            echo gdlr_get_image($theme_option['logot-id'], 'full', array(), $attr);
        }
    }
    ?>
						</a>
						<?php 
    // mobile navigation
    if (class_exists('gdlr_dlmenu_walker') && has_nav_menu('main_menu') && (empty($theme_option['enable-responsive-mode']) || $theme_option['enable-responsive-mode'] == 'enable')) {
        echo '<div class="gdlr-responsive-navigation dl-menuwrapper" id="gdlr-responsive-navigation" >';
        echo '<button class="dl-trigger">Open Menu</button>';
        wp_nav_menu(array('theme_location' => 'main_menu', 'container' => '', 'menu_class' => 'dl-menu gdlr-main-mobile-menu', 'walker' => new gdlr_dlmenu_walker()));
        echo '</div>';
    }
    ?>
					</div>
				</div>
开发者ID:hoa32811,项目名称:wp_thanhtrung_hotel,代码行数:31,代码来源:header.php

示例12: gdlr_get_portfolio_thumbnail

 function gdlr_get_portfolio_thumbnail($post_option, $size = 'full')
 {
     global $gdlr_related_section;
     if (is_single() && $post_option['inside-thumbnail-type'] != 'thumbnail-type' && empty($gdlr_related_section)) {
         $type = 'inside-';
     } else {
         $type = '';
     }
     switch ($post_option[$type . 'thumbnail-type']) {
         case 'feature-image':
             $image_id = get_post_thumbnail_id();
             if (!empty($image_id)) {
                 if (!is_single() || $gdlr_related_section) {
                     $ret = gdlr_get_image($image_id, $size);
                     $ret .= '<a class="portfolio-overlay-wrapper" ' . gdlr_get_portfolio_thumbnail_link($post_option) . ' >';
                     $ret .= '<span class="portfolio-overlay" >&nbsp;</span>';
                     $ret .= '<span class="portfolio-icon" ><i class="' . gdlr_get_portfolio_icon_class($post_option) . '" ></i></span>';
                     $ret .= '</a>';
                 } else {
                     $ret = gdlr_get_image($image_id, $size, true);
                 }
             }
             break;
         case 'image':
             $ret = gdlr_get_image($post_option[$type . 'thumbnail-image'], $size, true);
             break;
         case 'video':
             if (is_single() && empty($gdlr_related_section)) {
                 $ret = gdlr_get_video($post_option[$type . 'thumbnail-video'], 'full');
             } else {
                 $ret = gdlr_get_video($post_option[$type . 'thumbnail-video'], $size);
             }
             break;
         case 'slider':
             $ret = gdlr_get_slider($post_option[$type . 'thumbnail-slider'], $size);
             break;
         case 'stack-image':
             $ret = gdlr_get_stack_images($post_option[$type . 'thumbnail-slider']);
             break;
         default:
             $ret = '';
     }
     return $ret;
 }
开发者ID:AnduZhang,项目名称:resource-center,代码行数:44,代码来源:gdlr-portfolio-item.php

示例13: is_front_page

			<div class="gdlr-header-container container">
				<div class="gdlr-header-inner">
					<!-- logo -->
					<div class="gdlr-logo gdlr-align-left">
						<?php 
    echo is_front_page() ? '<h1>' : '';
    ?>
						<a href="<?php 
    echo home_url();
    ?>
" >
							<?php 
    if (empty($theme_option['logo-id'])) {
        echo gdlr_get_image(GDLR_PATH . '/images/logo.png');
    } else {
        echo gdlr_get_image($theme_option['logo-id']);
    }
    ?>
						
						</a>
						<?php 
    echo is_front_page() ? '</h1>' : '';
    ?>
						<?php 
    // mobile navigation
    if (class_exists('gdlr_dlmenu_walker') && (empty($theme_option['enable-responsive-mode']) || $theme_option['enable-responsive-mode'] == 'enable')) {
        echo '<div class="gdlr-responsive-navigation dl-menuwrapper" id="gdlr-responsive-navigation" >';
        echo '<button class="dl-trigger">Open Menu</button>';
        wp_nav_menu(array('theme_location' => 'main_menu', 'container' => '', 'menu_class' => 'dl-menu gdlr-main-mobile-menu', 'walker' => new gdlr_dlmenu_walker()));
        echo '</div>';
    }
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:31,代码来源:header.php

示例14: trim

<?php

/**
 * The template for displaying image post format
 */
global $gdlr_post_settings;
$post_format_data = '';
$content = trim(get_the_content(__('Read More', 'gdlr_translate')));
if (preg_match('#^<a.+<img.+/></a>|^<img.+/>#', $content, $match)) {
    $post_format_data = $match[0];
    $gdlr_post_settings['content'] = substr($content, strlen($match[0]));
} else {
    if (preg_match('#^https?://\\S+#', $content, $match)) {
        $post_format_data = gdlr_get_image($match[0], 'full', true);
        $gdlr_post_settings['content'] = substr($content, strlen($match[0]));
    } else {
        $gdlr_post_settings['content'] = $content;
    }
}
if (!empty($post_format_data)) {
    echo '<div class="gdlr-blog-thumbnail">';
    echo $post_format_data;
    if (!is_single() && is_sticky()) {
        echo '<div class="gdlr-sticky-banner">';
        echo '<i class="icon-bullhorn" ></i>';
        echo __('Sticky Post', 'gdlr_translate');
        echo '</div>';
    }
    echo '</div>';
}
?>
开发者ID:TheHiddenHaku,项目名称:fuzzy-waddle,代码行数:31,代码来源:thumbnail-image.php

示例15: empty

 $args['posts_per_page'] = empty($theme_option['related-post-num-fetch']) ? '4' : $theme_option['related-post-num-fetch'];
 $args['post__not_in'] = array(get_the_ID());
 $args['tax_query'] = array(array('terms' => $post_tags, 'taxonomy' => 'post_tag', 'field' => 'id'));
 $query = new WP_Query($args);
 if ($query->have_posts()) {
     $count = 0;
     echo '<div class="gdlr-related-post-wrapper">';
     echo '<span class="related-post-header">' . __('You may also like', 'gdlr_translate') . '</span>';
     echo '<div class="clear"></div>';
     while ($query->have_posts()) {
         $query->the_post();
         $count++;
         echo '<div class="related-post-widget three columns">';
         echo '<div class="related-post-widget-item">';
         $thumbnail_size = empty($theme_option['related-post-thumbnail-size']) ? 'thumbnail' : $theme_option['related-post-thumbnail-size'];
         $thumbnail = gdlr_get_image(get_post_thumbnail_id(), $thumbnail_size);
         if (!empty($thumbnail)) {
             echo '<div class="related-post-thumbnail"><a href="' . get_permalink() . '" >' . $thumbnail . '</a></div>';
         }
         echo '<div class="related-post-title"><a href="' . get_permalink() . '" >' . get_the_title() . '</a></div>';
         echo '<div class="clear"></div>';
         echo '</div>';
         echo '</div>';
         if ($count % 4 == 0) {
             echo '<div class="clear"></div>';
         }
     }
     echo '<div class="clear"></div>';
     echo '</div>';
     wp_reset_postdata();
 }
开发者ID:CityOfPhiladelphia,项目名称:business.phila.gov,代码行数:31,代码来源:single.php


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