This file contains hidden or 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
{% for event in site.data.events %} | |
<div class="previous-event"> | |
{% if event.name != 'blank' %} | |
<a href="{{event.url}}" target="_blank"> | |
{% if event.cover %}<img src="{{ site.baseurl }}/assets/images/site-cover/{{event.cover}}" alt="{{event.name}}"><br>{% endif %} | |
{{event.name}} | |
{% if event.date %} at {{event.date}}{% endif %} | |
</a> | |
{% endif %} | |
</div> |
This file contains hidden or 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
// video ga | |
var video = $('video'); | |
var video_url = ''; | |
if( video.length > 0 ){ | |
var isPlay = false; | |
video.on('play playing',function(){ | |
if( isPlay === false ) { | |
video_url = $(this).attr( 'src' ); | |
// Googleアナリティクス analytics.js の場合 | |
if ( typeof ga === 'function' ) { |
This file contains hidden or 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_filter( 'amp_skip_post', 'my_amp_skip_post' 10, 3 ); | |
function my_amp_skip_post( $flag, $post_id, $post ) { | |
$flag = true; | |
$checked = get_post_meta( $post_id, '_my_amp_post_control', true ); // カスタムフィールドの値取得 | |
if ( $checked == 1 ) { | |
$flag = false; | |
} | |
return $flag; |
This file contains hidden or 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 | |
// カスタム分類(タクソノミー)の book の スラッグ blue がチェックされてるかどうか | |
add_action( 'admin_head-post-new.php', 'book_term_post_edit_required' ); // 新規投稿画面でフック | |
add_action( 'admin_head-post.php', 'book_term_post_edit_required' ); // 投稿編集画面でフック | |
function book_term_post_edit_required() { | |
// book タクソノミーの blue タームのIDを取得 | |
$book_term = get_term_by( 'slug', 'blue', 'book' ); | |
$book_term_id = $book_term->term_id; | |
// ここでIDの有無をちゃんとチェックした方がいいのだけどね。 | |
?> |
This file contains hidden or 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
// Add Shortcode [myshortcode][/myshortcode] | |
function my_shortcode_func( $atts , $content = null ) { | |
return '<div>' . $content . '</div>'; | |
} | |
add_shortcode( 'myshortcode', 'my_shortcode_func' ); |
This file contains hidden or 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 | |
/** | |
* Support custom post type with bogo. | |
* | |
* @param array $localizable Supported post types. | |
* @return array | |
*/ | |
function my_localizable_post_types( $localizable ) { | |
$localizable[] = 'custom_post_type_name'; | |
return $localizable; |
This file contains hidden or 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_the_post_thumbnail( | |
$post, | |
$size, | |
array( | |
'class' => 'lazy', | |
'data-original' => 'img/example.jpg' | |
) | |
); |
This file contains hidden or 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
id_rsa | |
id_rsa.pub |
This file contains hidden or 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
<script> | |
jQuery(function($){ | |
$(document).on('contextmenu',function(){ return false; }); | |
}); | |
</script> |
This file contains hidden or 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 my_special_nav_class( $classes, $item ) { | |
// カスタム投稿タイプ special の投稿が表示されてる時カスタム投稿タイプアーカイブがメニューにあればCSSクラスを追加。 | |
if ( is_singular( 'special' ) && $item->type === 'post_type_archive' && $item->object === 'special' ) { | |
if ( ! in_array( 'current-post-ancestor', $classes ) ) { | |
$classes[] = 'current-post-ancestor'; | |
} | |
} | |
return $classes; | |
} |