This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* micro clearfix */ | |
.tomarebalink-box, | |
.tomarebalink-link1 { | |
zoom: 1;/* IE6,7の対応しないならいらないです */ | |
} | |
.tomarebalink-box:after, | |
.tomarebalink-link1:after { | |
content: ""; | |
display: block; | |
clear: both; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//functionにこれを追記する | |
error_reporting(0); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add_filesの部分は自分で理解しやすい名前をつけてOK | |
function add_files() { | |
// barba.js本体を読み込む | |
wp_enqueue_script( 'barba-js', get_template_directory_uri() . '/js/barba.min.js', array(), '1.0.0', true); | |
// カスタムのjsを読み込む | |
wp_enqueue_script( 'barba-custom', get_template_directory_uri() . '/js/barba-custom.js', 'array(barba-js)', '', true); | |
} | |
add_action('wp_enqueue_scripts', 'add_files'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dispatcher (newPageReadyのところに記述) | |
Barba.Dispatcher.on('newPageReady', function(currentStatus, oldStatus, container, newPageRawHTML) { | |
// 記事内のscriptタグを取得(NodeList) | |
// querySelectorAllはDOMで細かく指定してOK | |
// 例: querySelectorAll('#content script') | |
// ↑IDがcontentのタグの中のscriptタグ | |
var scripttag = document.querySelectorAll('script'); | |
// scriptそれぞれに処理 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="barba-wrapper"> | |
<div class="barba-container"> | |
<!-- ここに非同期で読み込みたいコンテンツ --> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<div id="content"> | |
<div class="container"> | |
<!-- コンテンツ部分を丸ごと読み込む場合 --> | |
<div id="barba-wrapper"><!-- 追加 --> | |
<div class="barba-container"><!-- 追加 --> | |
<div class="main"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 現在と同じページのリンクをクリックした場合、リロードをしない設定 | |
// リロードしたい場合は削除 | |
var links = document.querySelectorAll('a[href]'); | |
var cbk = function(e) { | |
if(e.currentTarget.href === window.location.href) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
} | |
}; | |
for(var i = 0; i < links.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ID9999の記事の"タイトル"を出力 | |
echo get_post( 9999 )->post_title; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ID9999の記事の"URL"を出力 | |
echo get_permalink( 9999 ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ID9999の記事の"サムネール画像"を出力 | |
echo get_the_post_thumbnail( 9999 ); | |
?> |
OlderNewer