Поддержка Проблемы и решения the_post_thumbnail() не работает…

  • Решено insanoff

    (@insanoff)


    add_theme_support('post-thumbnails');
    
    if ( function_exists('add_theme_support') ) {
        add_theme_support('post-thumbnails');
    }
    
    function get_thumbnail() {
        if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {
            the_post_thumbnail(array(210,60), array('class' => 'attachment-60x60')); // @param: array(height, width)
        } else {
            // via mediathek
            $attachments = get_children( array(
                    'post_parent'    => get_the_ID(),
                    'post_type'      => 'attachment',
                    'numberposts'    => 1, // show all -1
                    'post_status'    => 'inherit',
                    'post_mime_type' => 'image',
                    'order'          => 'ASC',
                    'orderby'        => 'menu_order ASC'
                    ) );
            foreach ( $attachments as $attachment_id => $attachment ) {
                echo wp_get_attachment_image( $attachment_id, array(210, 60) );
            }
    
        }
    }

    <?php get_thumbnail(); ?>

    масштаб должен быть 210х60:http://img718.imageshack.us/img718/9156/imgp0360b.jpg
    но в результате получается 60х60…
    вот: http://img231.imageshack.us/img231/6070/imagexo.jpg

Просмотр 2 ответов — с 1 по 2 (всего 2)
Просмотр 2 ответов — с 1 по 2 (всего 2)
  • Тема «the_post_thumbnail() не работает…» закрыта для новых ответов.