Exemple #1
0
 function mysiteapp_extract_thumbnail(&$content = null)
 {
     $thumb_url = null;
     $imageAlgos = uppsite_get_image_algos();
     if (uppsite_has_image_algo($imageAlgos, UppSiteImageAlgo::NATIVE_FUNC) && function_exists('has_post_thumbnail') && has_post_thumbnail()) {
         $thumb_url = get_the_post_thumbnail();
     }
     if (uppsite_has_image_algo($imageAlgos, UppSiteImageAlgo::THE_ATTACHED_IMAGE) && empty($thumb_url) && function_exists('the_attached_image')) {
         $temp_thumb = the_attached_image('img_size=thumb&echo=false');
         if (!empty($temp_thumb)) {
             $thumb_url = $temp_thumb;
         }
     }
     if (uppsite_has_image_algo($imageAlgos, UppSiteImageAlgo::GET_THE_IMAGE) && empty($thumb_url) && function_exists('get_the_image')) {
         $temp_thumb = get_the_image(array('size' => 'thumbnail', 'echo' => false, 'link_to_post' => false));
         if (!empty($temp_thumb)) {
             $thumb_url = $temp_thumb;
         }
     }
     if (uppsite_has_image_algo($imageAlgos, UppSiteImageAlgo::CUSTOM_FIELD) && empty($thumb_url) && !is_null($imageAlgos['extra'])) {
         $thumb_url = get_post_meta(get_the_ID(), $imageAlgos['extra'], true);
     }
     if (uppsite_has_image_algo($imageAlgos, UppSiteImageAlgo::FIRST_IMAGE) && empty($thumb_url)) {
         if (mysiteapp_is_fresh_wordpress_installation()) {
             $thumb_url = MYSITEAPP_HOMEPAGE_FRESH_COVER;
         } else {
             if (is_null($content)) {
                 ob_start();
                 the_content();
                 $content = ob_get_contents();
                 ob_get_clean();
             }
             $thumb_url = uppsite_extract_image_from_post_content($content);
         }
     }
     if (!empty($thumb_url)) {
         $thumb_url = uppsite_extract_src_url($thumb_url);
         if (!is_null($content)) {
             uppsite_nullify_thumb($content, $thumb_url);
         }
     }
     return $thumb_url;
 }
Exemple #2
0
function tm_category_loop()
{
    while (have_posts()) {
        the_post();
        ?>

			<div id="post-<?php 
        the_ID();
        ?>
" class="<?php 
        thematic_post_class();
        ?>
">
    			<?php 
        thematic_postheader();
        ?>
				<div class="entry-content">
<?php 
        $tm_image = the_attached_image('img_size=thumb');
        echo $tm_image;
        tm_content();
        ?>

				</div>
				<?php 
        thematic_postfooter();
        ?>
			</div><!-- .post -->

		<?php 
    }
}