WordPressのプラグインやテーマ、アップロードディレクトリ内の、ファイルとディレクトリの所有者及びパーミッションを設定するスクリプトです。
- plugins.sh
- themes.sh
- uploads.sh
function foo($path) { | |
// ここでなにかの処理 | |
...; | |
} | |
function recursive($dir) { | |
if (!file_exists($dir)) { | |
return; | |
} | |
$dhandle = opendir($dir); |
# Given | |
Given I am on [the] homepage | |
Given I am on "url" | |
# When | |
When I go to [the] homepage | |
When I go to "url" | |
When I reload the page |
<?php | |
/** | |
* カスタムフィールドを定義 | |
* | |
* @param array $settings MW_WP_Form_Setting オブジェクトの配列 | |
* @param string $type 投稿タイプ or ロール | |
* @param int $id 投稿ID or ユーザーID | |
* @param string $meta_type post | user | |
* | |
* @return array |
<?php | |
function wp_pagination() | |
{ | |
global $wp_query; | |
$big = 99999999; | |
$page_format = paginate_links( array( | |
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), | |
'format' => '?paged=%#%', | |
'current' => max( 1, get_query_var('paged') ), | |
'total' => $wp_query->max_num_pages, |
<?php | |
if ($terms = get_the_terms($post->ID, 'release_cat')) { | |
foreach ( $terms as $term ) { | |
echo esc_html($term->name) ; | |
} | |
} | |
?> |
<?php | |
if ($terms = get_the_terms($post->ID, 'release_cat')) { | |
foreach ( $terms as $term ) { | |
echo esc_html($term->name) ; | |
} | |
} | |
?> |
add_action('init', 'register_blog_custom_post'); | |
function register_blog_custom_post() { | |
register_post_type( | |
'blog', array( | |
'label' => 'ブログ', | |
'description' => '', | |
'public' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'menu_position' => 5, |
<?php $loop = new WP_Query( array('post_type' => 'post', 'posts_per_page' => 5 ) ); while ( $loop->have_posts() ) : $loop->the_post(); ?> | |
<li> | |
<a href="<?php the_permalink(); ?>"> | |
<span class="time"><?php the_time('Y年m月d日'); ?></span> | |
<?php the_title(); ?> | |
</a> | |
</li> | |
<?php endwhile; ?> | |
<?php wp_reset_postdata(); ?> |