Q.第3ブロックのバナーの数を増やしたい
トップページ第3ブロックの円形バナーを3つから4つに増やす方法を教えてください。
A.下記のphpファイルの該当箇所を編集します
編集するファイル:page-welcome.php
編集する箇所:71行目
①3列から4列へ幅の調整
<div class="col-sm-40 text-center">
↓
<div class="col-sm-30 text-center">
②4列目の挿入
83行目の
<?php endfor; ?>
のすぐ下に、以下のコードを挿入
<div class="col-sm-30 text-center">
<div style="background-image:url(【アップロードした画像ファイルのURL】); width:70%" class="img-circle square-80 heightaswidth mb20 circle-banner">
<a class="no-decoration" href="【リンクURL】" target="_blank">
<div class="cover text-center">
<h3 class="verticalcenter">【画像上の表示される文字】</h3>
</div>
</a>
</div>
<h4 class="text-center third-banner-headline mb20">【タイトル】</h4>
<p class="text-justify third-banner-body">【説明文】</p>
<div class="button romaji"><a href="【READMOREのリンクURL】" target="_blank">READ MORE</a></div>
<div class="visible-xs"></div>
</div>
※【】の部分はお客様の環境にて適宜ご変更下さい。
尚、4列にした時の各項目の変更方法は、3列目までは今まで通り「外観」>「テーマオプション」でご変更頂き、4列目のみ、上記のようにファイルを編集するという方法になります。
【応用編】3×2段で6つ表示する方法
「①3列から4列へ幅の調整」は行わず、幅40のままにします。
先述の手順と同様に、83行目の
<?php endfor; ?>
のすぐ下に、以下のコードを3つ挿入します。
<div class="col-sm-40 text-center">
<div style="background-image:url(【アップロードした画像ファイルのURL】); width:70%" class="img-circle square-80 heightaswidth mb20 circle-banner">
<a class="no-decoration" href="【リンクURL】" target="_blank">
<div class="cover text-center">
<h3 class="verticalcenter">【画像上の表示される文字】</h3>
</div>
</a>
</div>
<h4 class="text-center third-banner-headline mb20">【タイトル】</h4>
<p class="text-justify third-banner-body">【説明文】</p>
<div class="button romaji"><a href="【READMOREのリンクURL】" target="_blank">READ MORE</a></div>
<div class="visible-xs"></div>
</div>
これで3×2段=計6つの円形バナーが表示されました。
さらにカスタムCSSで、1段目と2段目の間に余白を入れて整えます。※数値はお好みで調節してください。
.home .main-content #third .amore-section div.col-sm-40:nth-child(n+4){
margin-top: 50px;
}
@media (min-width: 768px){
.home .main-content #third .amore-section div.col-sm-40:nth-child(n+4){
margin-top: 90px;
}
}
この記事は役に立ちましたか?
もし参考になりましたら、下のボタンで教えてください。
今後の記事作成の参考とさせて頂きます!