0

我创建了一个新帖子并选择了一张特色图片。为此,我创建了一个名为featured-image(自定义图像大小)的类。对齐在左侧,我希望它能够响应。但是对于以下情况,我没有想要的结果。图像没有响应。

有什么帮助吗?

functions.php具有以下代码:-

<?php

add_action( 'after_setup_theme', 'setup' );  

    function setup() {  

        add_theme_support( 'post-thumbnails' ); 

        add_image_size( 'featured-image', 590, 520, true );  

        }

 add_filter( 'image_size_names_choose', 'custom_image_sizes_choose' );  

    function custom_image_sizes_choose( $sizes ) {  
        $custom_sizes = array(  
            'featured-image' => 'alignleft'  
        );  
        return array_merge( $sizes, $custom_sizes );  
    }  

?>  

category-id.php具有以下代码:-

<div class="column two-third">
   <?php the_post_thumbnail('featured-image', array('class' => 'alignleft'));?>                                 
</div>

帖子中:例如:

<a href="http://www.domainname/testssss/attachment/2222" rel="attachment wp-att-246">
   <img src="http://www.domainname.com/wp-content/uploads/2013/05/2222-590x520.png" alt="2222" class="alignleft size-featured-image wp-image-246" />
</a>

style.css具有以下 css 规则:-

img.alignleft
{
    max-width: 100%;
}

@media only screen and (max-width: 767px) 
{
    img.alignleft
    {
      max-width: 100%;
      display:block;
      height:auto;
    }
}
4

0 回答 0