ルクセリタスの記事一覧表示をカスタマイズ(カード型・インフィード対応)

2019-02-26ルクセリタス・カスタマイズGoogle

ルクセリタスの記事一覧表示をカスタマイズ(カード型・インフィード対応)

バージョンと初期デザインについて

当サイトで使用中のバージョンは以下です。(記事作成時)

Luxeritas Child Themeバージョン: 3.0.0
Luxeritasバージョン: 3.5.7

ダウンロードはこちら

ルクセリタスに用意されている「デザイン選択」からのデザイン変更はせずにデフォルトからカスタマイズしています。

 

記事一覧デザイン変更

 BEFORE → AFTER

 

アドセンスのインフィード広告に寄せたデザインにしました。

カテゴリー名も左上に出しています。

 

外観カスタマイズ設定

「外観」→「カスタマイズ」から「グリッドレイアウト」を選択し、内容を変更して下さい。

こちらはカード型最大1列でのカスタマイズですので、そのように設定を。
「記事を読む」に短いタイトルを付けるのチェックを外します。

 

スタイルシート追記

子テーマのスタイルシートにCSSを追記します。

 

「Luxeritas」→「子テーマの編集」で「スタイルシート」を選択します。(Ver.3.7.9以前は「style.cssタブ」)

Luxelitasスタイルシート編集画面

 

 以下を追記します。

 

結構長いですが、以下のすべてを追記します。
ちなみに、ちょっと見慣れない div[id^="card-“] を使用していますが使い方は以下の通りです。

 div[id^="card-“] の意味は、前方一致です。
前方一致 ⇒ [【A】^="【B】"]で、【A】が【B】で始まる要素
後方一致 ⇒ [【A】$="【B】"]で、【A】が【B】で終わる要素
部分一致 ⇒ [【A】*="【B】"]で、【A】に【B】を含む要素

 

タイル型の記事一覧を編集したい場合は div[id^="tile-“]

 

カード枠、タイトル、日付の設定

コードを表示
/*************/
/*記事一覧 */
/*************/
/*記事一覧ボックス枠*/
div[id^="card-"]
.toc:not(#bottom-area):not(.posts-list-middle-widget):not(#bottom-area):not(.posts-list-under-widget) {
padding: 0px;
box-shadow: 0 2px 5px #f0f0f0;
border: none;
transition: .3s;
height:150px;
}
/*記事一覧ボックス枠(オンマウス)*/
div[id^="card-"]
.toc:not(#bottom-area):not(.posts-list-middle-widget):not(#bottom-area):not(.posts-list-under-widget):hover {
box-shadow: 0 4px 20px #a5a5a5;
transform: translateY(-5px);
}
/*タイトルのサイズと位置*/
div[id^="card-"] h2 {
color: #555;
font-weight: bold;
padding-top: 20px;
padding-right: 15px;
padding-bottom: 25px;
padding-left: 10px;
margin: 0px;
font-size: 18px;
}
/*記事一覧の日付*/
.meta, .post .meta {
border-top: 0px;
padding-top: 12px;
padding-right: 12px;
padding-bottom: 0px;
padding-left: 12px;
color: #b5b5b5;
font-weight: bolder;
float:right;
}
/*カレンダーアイコン*/
.fa-calendar:before {
content: "f017";
font-size: 115%;
}

 

カテゴリー表示、アイキャッチサイズの設定

コードを表示
/*記事一覧のカテゴリー*/
#list span.category {
text-align: center;
position: absolute;
top: 12px;
left: 12px;
height: 22px;
border-radius: 8px; /*角の丸み*/
background: #b67070;
font-size: 11px;
padding: 0 10px;
line-height: 22px;
color: #fff;
}
#list span.category a{
color: #fff;
font-weight: bold;
text-decoration: none;
}
/*記事一覧アイキャッチサイズ*/
#list .term img {
margin-bottom: 0px;
padding: 10px;
}
#list div[id^="card-"] .term img {
max-width: 200px;
width: 100%;
}

 

 

「記事を読む」の位置や見た目をインフィード広告に似せる

コードを表示
/*記事を読む*/
.read-more-link,
.read-more-link i {
position: relative; top:-60px; left:-10px;
display: inline-block;
padding: 8px 10px 5px 1px;
text-decoration: none;
width:107px;
background: #fff;
border: solid 1px;
color: #7f7f7f;
border-color:#7f7f7f;
text-align:center;
}

 

スマホ用設定

コードを表示
/* 一覧スマホ用 */
@media only screen and (max-width:575px){
#list div[id^="card-"] h2 {
font-size: 14px;
}
#list div[id^=card-] span.date {
position: absolute;
bottom: 3px;
right: 8px;
}
#list div[id^=card-] .meta {
margin: 0;
padding: 0;
font-size: 14px;
}
}

 

その他の記事一覧カスタマイズ方法

カード型

タイル型

 

カラーの変更

色や、配置などはお好みで編集してご利用下さい。

マカロンビビッドパステル伝統色和色セーフ色名 配色パターンサンプル

関連記事