Skip to content

Instantly share code, notes, and snippets.

@yutaide
Created May 19, 2019 15:29
Show Gist options
  • Save yutaide/4cfaafe20c9e4a962712c91e07cc63fb to your computer and use it in GitHub Desktop.
Save yutaide/4cfaafe20c9e4a962712c91e07cc63fb to your computer and use it in GitHub Desktop.
完成形コード
<!--
******************************
@初期設定
HTMLテンプレート
HTMLバージョン:HTML5
文字コード:UTF-8
Bootstrap
******************************
-->
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="./style.css">
<title></title>
<style>
.navbar a{
color: black !important;
transition: font-size 0.3s ease-in 0;
}
.navbar a:hover{
font-size: 1.5em;
}
</style>
</head>
<body>
<!-- ここから記述 -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="<?php echo esc_url(get_home_url()); ?>">Home <span class="sr-only">(current)</span></a>
</li>
<?php
$category_id = get_cat_ID('Blog');//指定したカテゴリーのIDを取得
$category_link = get_category_link($category_id);//このカテゴリーのURLを取得
?>
<li class="nav-item">
<a class="nav-link" href="<?php echo esc_url($category_link); ?>">Blog <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="プロフィールページのURLを記述してください">Profile <span class="sr-only">(current)</span></a>
</li>
</ul>
</div>
</nav>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment