arkheのフックを使った固定フッターメニューの作り方

arkheのフックを使って、カスタマイズするやり方。ヘッダーのカスタマイズや固定フッターを作ったりする方法を書いておこうと思います。

完成例


function.phpに追加するコード

/*
 * フッター後ろ
 */
add_action(
	'arkhe_after_footer',
	function() {
		?>

<div id="fix_bottom_menu">
	<ul class="menu_list">
		<li class="menu-item"><a href="#">
			<span>メニュー1</span></a>
		</li>
		<li class="menu-item"><a href="#">
			<span>メニュー2</span></a>
		</li>
		<li class="menu-item"><a href="#">
			<span>メニュー3</span></a>
		</li>
	</ul>
</div>

		<?php
	}
);

CSS に追加するコード

 #fix_bottom_menu  {
    bottom: 0px;
    display: none;
    left: 0;
    position: fixed;
} #fix_bottom_menu :before {
    display: block;
    background: #969285 ;
    opacity: 0.9;
    content: "";
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 0;
} #fix_bottom_menu  .menu_list {
    display: flex;
    height: 50px;
    justify-content: space-between;
    position: relative;
    z-index: 1;
} #fix_bottom_menu  .menu-item {
    flex: 1 1 100%;
    text-align: center;
    position: relative;
    height: 100%;
    padding-top: 3px;
    background-color: rgb(240, 80, 80); 
}


 #fix_bottom_menu  a{
    text-decoration: none;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
    -ms-transform: translateX(-50%);
} #fix_bottom_menu  li::before {
    content: "";
    display: inline-block;
    background-size:contain;
    background-repeat: no-repeat;
    position: absolute;
    width: 30px;
    height: 30px;
    left: 50%;
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
    -ms-transform: translateX(-50%);
} #fix_bottom_menu  li:nth-child(1)::before {
    background-image: url(iconのURL);
} #fix_bottom_menu  li:nth-child(2)::before {
    background-image: url(iconのURL);
} #fix_bottom_menu  li:nth-child(3)::before {
    background-image: url(iconのURL);
}


 #fix_bottom_menu  span {
    display: block;
    font-size: 10px;
    color: #fff ;
    line-height: 1;
    margin-top: 4px;
    width: 100%;
}
@media (max-width: 959px){ #fix_bottom_menu  {
    box-shadow: 0 0 4px rgb(0 0 0 / 10%);
    transition: bottom .4s;
    width: 100%;
    z-index: 100;
    color: #ffffff ;
    display: block;
    padding-bottom: calc(env(safe-area-inset-bottom)*.5);
}
}


あ、ちょうどよかった。ちょっとそこのハートマークを押してくれるかな。 ん?画面下のハートだ。赤くなった? おぉありがとう。 神のご加護があらんことを。