twenty sixteenのトップページのタイトルを消すは下記参照。
トップページの下にカテゴリーを表示する。
content-page.phpのthe_content();の上に下記を入れる。
$categories = get_categories( array(
'orderby' => 'name',
'order' => 'ASC'
));
echo '<div class=' . '"grid2"'.'>';
foreach( $categories as $category ) {
echo '<div class=' . '"item2"'.'><a href=' . get_category_link( $category->term_id ) . '>' . $category->name. '</a></div>';
};
echo '</div>';
子テーマのStylesheetに下記を入れる。
.grid2 {
display: grid; /* グリッドレイアウト */
gap: 10px; /* 隙間は10px */
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* 最小400px */
margin-bottom: 30px;
}
.item2 {
text-align: center;
border-radius: 5px;
border: 2px solid #808080; /* ボタンに枠線を設定 */
text-decoration: none; /* 下線を非表示 */
}
.item2 a{
display: grid; /* リンク要素をグリッドコンテナとして設定 */
grid-column: 1 / -1; /* リンク要素を親要素の全体に広げる */
text-decoration: none; /* 下線を非表示 */
padding-top: 10px; /* 上側のpadding */
padding-bottom: 10px; /* 下側のpadding */
--btn-color:#808080;/*ボタンの色*/
border-color: var(--btn-color);
color: var(--btn-color);
transition: all 0.3s ease; /* ホバー時の変化をなめらかに */
}
.item2 a:hover{
color: white;
background-color: var(--btn-color);
}
各ページにWP-PostViewsを使って記事の閲覧数を表示。
content-single.phpのdiv entry-contentの最下部に入れる。
<?php if(function_exists('the_views')) { the_views(); } ?>
https://webantena.net/wordpress/the-views-and-get-most-viewed
投稿ページの投稿者を消す。
incディレクトリー配下にあるtemplate-tags.phpが該当のファイルを変更する。
function twentysixteen_entry_meta() {
/*削除*/
// if ( 'post' === get_post_type() ) {
// $author_avatar_size = apply_filters( 'twentysixteen_author_avatar_size', 49 );
// printf(
// '<span class="byline">%1$s<span class="screen-reader-text">%2$s </span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',
// get_avatar( get_the_author_meta( 'user_email' ), $author_avatar_size ),
// /* translators: Hidden accessibility text. */
// _x( 'Author', 'Used before post author name.', 'twentysixteen' ),
// esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
// get_the_author()
// );
// }