簡易的にタグごと表示する場合
1 |
<?php $list = wp_list_categories( 'echo=0&hide_empty=0&hierarchical=1' ); ?> |
オプションを細 […]
code plugin html/css javascript php
簡易的にタグごと表示する場合
1 |
<?php $list = wp_list_categories( 'echo=0&hide_empty=0&hierarchical=1' ); ?> |
オプションを細 […]
下記コードをfunctions.phpへ記述追加
1 2 3 4 5 6 7 |
// メディア追加時のwidth/height自動追加を削除 function my_remove_width_attribute( $options ) { if ( $options['tinymce'] ) { wp_enqueue_script( 'remove_width_attribute', get_template_directory_uri() . '/js/remove_width_attribute.js', array( 'jquery' ), '1.0.0', true); } } add_action( 'wp_enqueue_editor', 'my_remove_width_attribute', 10, 1 ); |
一般的なquery_postsでのメインループの条件 [crayon-5ee15671605c05478595 […]
フォーマットを指定して投稿日を表示するコード
1 |
<?php echo get_the_date('Y年n月j日(l)'); ?> |
[…]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<?php $arg = array( 'posts_per_page' => 10, // 表示する件数 'orderby' => 'date', // 日付ソート 'order' => 'DESC', // DESCで降順、ASCで昇順 'category_name' => 'wp-customize' // カテゴリーのスラッグを指定 ); $posts = get_posts( $arg ); if( $posts ): ?> <ul> <?php foreach ( $posts as $post ) : setup_postdata( $post ); ?> <li><?php the_time( 'Y.m.d' ); ?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> <?php endif; wp_reset_postdata(); ?> |
カスタム投稿名を出力するコード
1 |
<?php echo esc_html(get_post_type_object(get_post_type())->label); ?> |
検索語を上に入力し、 Enter キーを押して検索します。キャンセルするには ESC を押してください。