我创建了一个新帖子,并选择了一个精选图片。为此,我创建了一个名为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;
}
}