Wordpress精选图像大小均匀高度
我将特色图片设置为帖子,如果未设置,则显示默认图片。我的代码在这里Wordpress精选图像大小均匀高度,wordpress,image,twitter-bootstrap,dynamic-featured-image,Wordpress,Image,Twitter Bootstrap,Dynamic Featured Image,我将特色图片设置为帖子,如果未设置,则显示默认图片。我的代码在这里 <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'full', array( 'class' => 'img-responsive' ) ); } else { ?> <img src="default-image.jpg" class="img-responsive" /> <?php } ?> 问题很简单。所
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail( 'full', array( 'class' => 'img-responsive' ) );
} else { ?>
<img src="default-image.jpg" class="img-responsive" />
<?php } ?>
问题很简单。所有的图像都有不同的高度。我希望他们都是统一的高度,使我的引导网格线均匀
有什么想法吗?网上有很多示例,但没有一个适用于特色图像和默认图像。请将下面的代码粘贴到functions.php文件中
add_image_size('image_size', 510, '520', true);//510 is width and 520 in height
现在,当你上传wordpress post中的任何图像时,它会自动调整为510*520,但bee care的完整图像大小必须大于你想要的比例
如何打电话请在下面查询
请将下面的代码粘贴到functions.php文件中
add_image_size('image_size', 510, '520', true);//510 is width and 520 in height
现在,当你上传wordpress post中的任何图像时,它会自动调整为510*520,但bee care的完整图像大小必须大于你想要的比例
如何打电话请在下面查询
在代码中,添加unim类,如下所示:
the_post_thumbnail( 'full', array( 'class' => 'unim' ) );
为了在站点上实现统一的映像,您可以通过NPM使用开源库引导程序
npm install uniformimages
或者您可以访问github页面:
https://github.com/chigozieorunta/uniformimages
下面是一个使用unim类的示例,您需要jQuery来实现这一点:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="uniformimages.css" rel="stylesheet" type="text/css"/>
<script src="uniformimages.js" type="text/javascript"></script>
</head>
<body>
<section>
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
<a href="product1.html">
<img src="image1.jpg" class="unim"/>
</a>
</div>
<div class="col-sm-4">
<a href="product2.html">
<img src="image2.jpg" class="unim"/>
</a>
</div>
<div class="col-sm-4">
<a href="product3.html">
<img src="image3.jpg" class="unim"/>
</a>
</div>
</div>
</div>
</section>
</body>
在代码中,添加unim类,如下所示:
the_post_thumbnail( 'full', array( 'class' => 'unim' ) );
为了在站点上实现统一的映像,您可以通过NPM使用开源库引导程序
npm install uniformimages
或者您可以访问github页面:
https://github.com/chigozieorunta/uniformimages
下面是一个使用unim类的示例,您需要jQuery来实现这一点:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="uniformimages.css" rel="stylesheet" type="text/css"/>
<script src="uniformimages.js" type="text/javascript"></script>
</head>
<body>
<section>
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
<a href="product1.html">
<img src="image1.jpg" class="unim"/>
</a>
</div>
<div class="col-sm-4">
<a href="product2.html">
<img src="image2.jpg" class="unim"/>
</a>
</div>
<div class="col-sm-4">
<a href="product3.html">
<img src="image3.jpg" class="unim"/>
</a>
</div>
</div>
</div>
</section>
</body>