//content.php を呼び出す
1 |
<?php get_template_part( 'content' ); ?> |
// […]
code plugin html/css javascript php
//content.php を呼び出す
1 |
<?php get_template_part( 'content' ); ?> |
// […]
1 2 3 4 5 6 7 8 |
<?php function testFunc() { ob_start(); echo the_title(); return ob_get_clean(); } add_shortcode('test', 'testFunc'); ?> |
Browserを調べる
1 2 3 |
<?php echo getenv('HTTP_USER_AGENT'); ?> |
Browser毎に処 […]
ページをスクロールしたら、ヘッダーを上部に固定したい できればチョットだけ滑らかなアニメーションを入れたい事っ […]
JavaScriptでcookieを扱う場合には 色々処理が面倒だったりしますよね 例えば。。。 値のエンコー […]
iOSでは、input要素に指定しているフォントサイズが「16px」未満だと、フォーカス時にズームされるという […]
1 2 3 4 5 6 7 8 9 10 11 |
$(function() { //ウインドウがリサイズされたら処理 $(window).resize(function() { //ウインドウの高さを変数に格納 var w = $(window).width(); //ウインドウの高さを変数に格納 var h = $(window).height(); //ウインドウの高さをspan要素に出力 $('span').text(h); }); }); |
[crayon-5f7fb64d041b56 […]
トップページなどに トピック一覧や、サムネイル付きの記事を表示する際には 記事毎のタイトルの長さや、サマリーテ […]
Categories Imagesはカテゴリにアイキャッチを登録して表示したい時に便利なプラグイン。 カテゴリ […]
アイキャッチ画像を表示するWordpressテーマを使っている場合やオリジナルテーマでアイキャッチ付きの投稿リ […]
WordPress5.0から「Gutenberg」というエディタがされました。使い慣れていないとテーマ作成や変 […]
Auto Post Thumbnailの導入 WordPress管理画面「プラグイン」→「新規追加」 「Aut […]
「Show Current Template」は サイトのツールバーに表示中のページに使われているテンプレート […]
Intuitive Custom Post Order の導入 WordPress管理画面「プラグイン」→「新 […]
簡易的にタグごと表示する場合
1 |
<?php $list = wp_list_categories( 'echo=0&hide_empty=0&hierarchical=1' ); ?> |
オプションを細 […]
httpからhttpsへリダイレクトするには.htaccessに下記を追加 評価を引き継ぐ必要がある場合は、下 […]
下記コードを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-5f7fb64d04edb9737378 […]
フォーマットを指定して投稿日を表示するコード
1 |
<?php echo get_the_date('Y年n月j日(l)'); ?> |
[…]
コード例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php get_header(); ?> <main> <?php if(have_posts()): while(have_posts()):the_post(); ?> <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <time datetime="<?php the_time('Y-m-d'); ?>"><?php the_time('Y.m.d'); ?></time> <p><?php the_category(', '); ?></p> <p><?php the_content('Read more'); ?></p> <?php endwhile; endif; ?> <?php previous_post_link('%link','古い記事へ'); ?> <?php next_post_link('%link','新しい記事へ'); ?> </main> <?php get_sidebar(); ?> <?php get_footer(); ?> |
検索語を上に入力し、 Enter キーを押して検索します。キャンセルするには ESC を押してください。