Esempio n. 1
0
                                    <div class="clear"></div>
                                    
        <?php 
        // BEGIN Post Image
        $post_image_url = get_post_meta($post->ID, 'post_image', true);
        // Grab the preview image from the custom field 'post_image', if set.
        if (!$post_image_url && has_post_thumbnail($post->ID)) {
            $tmp_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
            $post_image_url = $tmp_image[0];
        }
        if ($post_image_url) {
            if ($udesign_options['enable_custom_featured_image'] == 'yes') {
                // Customize the dimension and alignment of the 'Featured Image' ...
                if ($udesign_options['force_image_dimention'] == 'yes') {
                    //... by a function defined in 'function.php' specifically for this theme using TimThumb
                    echo customized_featured_image($page->ID, $post_image_url, $udesign_options['featured_image_width'], $udesign_options['featured_image_height'], $udesign_options['featured_image_alignment']);
                } else {
                    //... by the default WP 'the_post_thumbnail()' function which doesn't stretch images if they are smaller
                    echo the_post_thumbnail(array($udesign_options['featured_image_width'], $udesign_options['featured_image_height']), array('class' => $udesign_options['featured_image_alignment']));
                }
            } else {
                ?>
                                            <div class="post-image-holder pngfix">
                                                <div class="post-image">
                                                    <span class="post-hover-image pngfix"> </span>
                                                    <a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title_attribute();
                ?>
Esempio n. 2
0
/**
 * Display the post image linked (optional) to the post
 * @param int $post_id Post ID.
 * @param bool $linked Set to 'true' if the image should link to the post or 'false' otherwise
 * @return string HTML formatted post image linking (optional) to the Post with $post_id
 */
function display_post_image_fn($post_id, $linked = true)
{
    global $udesign_options;
    $post_image_url = get_post_meta($post_id, 'post_image', true);
    // Grab the preview image from the custom field 'post_image', if set.
    if (!$post_image_url && has_post_thumbnail($post_id)) {
        $tmp_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'single-post-thumbnail');
        $post_image_url = $tmp_image[0];
    }
    if ($post_image_url) {
        if ($udesign_options['enable_custom_featured_image'] == 'yes') {
            // Customize the dimension and alignment of the 'Featured Image' ...
            if ($udesign_options['force_image_dimention'] == 'yes' && $udesign_options['disable_timthumb'] != 'yes') {
                //... by a function defined in 'function.php' specifically for this theme using TimThumb
                echo customized_featured_image($post_id, $post_image_url, $udesign_options['featured_image_width'], $udesign_options['featured_image_height'], $udesign_options['featured_image_alignment'], $linked);
            } else {
                //... by the default WP 'the_post_thumbnail()' function which doesn't stretch images if they are smaller
                echo the_post_thumbnail(array($udesign_options['featured_image_width'], $udesign_options['featured_image_height']), array('class' => $udesign_options['featured_image_alignment']));
            }
        } else {
            ?>
            <div class="post-image-holder pngfix">
                <div class="post-image">
                    <span class="post-hover-image pngfix"> </span>
<?php 
            if ($linked) {
                ?>
                        <a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title_attribute();
                ?>
"><img class="hover-opacity" src="<?php 
                echo udesign_process_image($post_image_url, 570, 172, 1, 90);
                ?>
" alt="<?php 
                the_title_attribute();
                ?>
" /></a>
<?php 
            } else {
                ?>
                        <img class="hover-opacity" src="<?php 
                echo udesign_process_image($post_image_url, 570, 172, 1, 90);
                ?>
" alt="<?php 
                the_title_attribute();
                ?>
" />
<?php 
            }
            ?>
                </div>
            </div>
<?php 
        }
    }
}