Skip to content

Instantly share code, notes, and snippets.

@macvox
macvox / prevnext16
Last active February 14, 2018 06:54
// Previous/next post navigation.
the_post_navigation( array(
'next_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Next', 'twentysixteen' ) . '</span> ' .
'<span class="screen-reader-text">' . __( 'Next post:', 'twentysixteen' ) . '</span> ' .
'<span class="post-title">%title</span>',
'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Previous', 'twentysixteen' ) . '</span> ' .
'<span class="screen-reader-text">' . __( 'Previous post:', 'twentysixteen' ) . '</span> ' .
'<span class="post-title">%title</span>',
) );
@macvox
macvox / prevnext
Last active February 14, 2018 06:54
$post_id = $post->ID; // current post ID
$cat = get_the_category();
$current_cat_id = $cat[0]->cat_ID; // current category ID
$args = array(
'category' => $current_cat_id,
'orderby' => 'post_date',
'order' => 'DESC'
);
$posts = get_posts( $args );
ul.inline01 {font-size:0px;}
ul.inline01 li {
display:inline-block;
border:1px #ccc solid;
list-style:none;
padding:0 3px;
}
<ul class="inline01">
<li>メニュー1</li>
<li>メニュー2</li>
<li>メニュー3</li>
</ul>
add_shortcode('ss_screenshot', 'ss_screenshot_shortcode');
function ss_screenshot_shortcode($atts){
$width = intval($atts['width']);
$width = (100 <= $width && $width <= 300) ? $width : 200;
$site = trim($atts['site']);
[ss_screenshot width='300' site='http://www.yahoo.co.jp']
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
@macvox
macvox / add_head02
Last active February 3, 2018 07:08
function hook_javascript() {
?>
<script>
alert('Page is loading...');
</script>
<?php
}
add_action('wp_head', 'hook_javascript');
@macvox
macvox / add_head01
Last active February 3, 2018 07:09
function hook_css() {
?>
<style>
.wp_head_example {
background-color : #f1f1f1;
}
</style>
<?php
}
add_action('wp_head', 'hook_css');