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 | |
// [gist id="ID" file="FILE"] | |
function gist_shortcode($atts) { | |
return sprintf( | |
'<script src="https://gist.github.com/%s.js%s"></script>', | |
$atts['id'], | |
$atts['file'] ? '?file=' . $atts['file'] : '' | |
); | |
} add_shortcode('gist','gist_shortcode'); |
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
add_action( 'register_form', 'add_register_field' ); | |
function add_register_field() { ?> | |
<p> | |
<label><?php _e('ここに質問内容') ?><br /> | |
<input type="text" name="user_proof" id="user_proof" class="input" size="25" tabindex="20" /></label> | |
</p> | |
<?php } | |
add_action( 'register_post', 'add_register_field_validate', 10, 3 ); | |
function add_register_field_validate( $sanitized_user_login, $user_email, $errors) { |
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 | |
$attachments = get_children( | |
array( | |
'post_type' => 'attachment', | |
'post_mime_type' => 'image', | |
'post_parent' => $post->ID | |
)); | |
if(count($attachments) > 1) { ?> | |
<!-- 画像が複数ある場合。スライダー使うとか --> | |
<?php } else { ?> |
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
<link type="text/css" href="<?php bloginfo('stylesheet_url'); echo '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" rel="stylesheet" /> |
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 | |
if ( function_exists( 'add_image_size' ) ) { | |
add_image_size( 'foo-thumb', 400, 9999 ); | |
add_image_size( 'bar-thumb', 240, 180, true ); | |
} ?> | |
/*テーマファイルで下記のように記述*/ | |
<?php echo get_the_post_thumbnail($post->ID, 'foo-thumb'); ?> |
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 | |
if(current_user_can('read_private_pages')) : | |
?> | |
//ログインしないと見れない場所 | |
<?php endif; ?> |
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 has_thumb_class($classes) { | |
global $post; | |
if( has_post_thumbnail($post->ID) ) { $classes[] = 'foo'; } | |
return $classes; | |
} | |
add_filter('post_class', 'has_thumb_class'); | |
?> |
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_action('init', 'foo_custom_init'); | |
function foo_custom_init() | |
{ | |
$args = array( | |
'exclude_from_search' => true, // ここでtrueを指定する | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, |
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 escape_my_code( $attr, $content = null ) { | |
$content = clean_pre($content); | |
return '<pre"><code>' . | |
str_replace('<', '<', $content) . | |
'</code></pre>'; | |
} | |
add_shortcode('code', 'escape_my_code'); | |
?> |
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 enable_threaded_comments(){ | |
if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) { | |
wp_enqueue_script('comment-reply'); | |
} | |
} | |
add_action('get_header', 'enable_threaded_comments'); | |
?> |
OlderNewer