y

m

d

*[nascha_page_id] wp note よく使うテンプレート トップページ用テンプレート:index.php、home.php、front-page.php カテゴリー用テンプレート:category.php タグ用テンプレート:tag.php カスタム投稿タイプ用テンプレート:single-〇〇.php(〇〇はカスタム投稿タイプ名) 検索結果ページ用テンプレート:search.php 取得系 テンプレート名を取得 global $template; // テンプレートファイルのパスを取得 $temp_name = basename($template); // パスの最後の名前(ファイル名)を取得 サイトタイトルとキャッチフレーズの取得 $title = get_bloginfo('name'); $desc = get_bloginfo('description'); よく使う取得系 echo home_url(); bloginfo('template_directory'); echo bloginfo('name'); echo get_the_permalink(); $page_id = get_the_ID(); //ページID $page_date = get_the_date('Y.m.d'); //作成日 $page_permalink = get_permalink(); //自ページのURL global $template; // テンプレートファイルのパスを取得 $temp_name = basename($template); // パスの最後の名前(ファイル名)を取得 自動で入るPや改行を取る(the_content()の上に入れる) remove_filter ('the_content', 'wpautop'); 現在の投稿本文をショートコード展開させて取得 $content = apply_filters( 'the_content', get_post_field('post_content', get_the_ID()) ); print $content; ページの本文をフィルターフックで整形して取得 //この例ではスラッグ名「top-page」のカスタム投稿記事(top)を取得 $args=array( 'name' => 'top-page', 'post_type' => 'top' ); $get_page_id = get_posts($args); $get_page_id = $get_page_id[0]->ID; $page_id = $get_page_id; $page = get_post($page_id, 'OBJECT' , 'raw'); $page_include = apply_filters('the_content',$page->post_content); 本文の展開表示 $content_text = get_the_content("",true); $content_text = str_replace("is-style-", "", $content_text); $content_text = str_replace("", "\n", $content_text); print $content_text; HTMLタグとショートコードをすべて取り除く $content = wp_strip_all_tags( $content ); $content = strip_shortcodes( $content ); 自分のURLを取得する list($url, $item_ID) = explode("?", $_SERVER["REQUEST_URI"]); 一部抜粋 echo mb_substr(get_the_excerpt(), 0, 60); プラグイン 問い合わせフォーム contact-form-7 contact-form-7-add-confirm contact-form-7-multi-step-module カスタム投稿タイプのパーマリンクを変更 custom-post-type-permalinks 登録フォームのハイライト HTML Editor Syntax Highlighter カスタムフィールドを追加 advanced-custom-fields タグの表示順を自由に並び替える Custom Taxonomy Order 検索と置換 search-regex ページ送り WP-PageNavi サムネを作らない 1:管理画面の画像サイズより不要なサイズについて0を指定する 2:functions.phpに指定されている場合は「add_theme_support('post-thumbnails');」を探してコメントアウトする 3:medium_large_size_wの生成を停止する http://ドメイン名/wp-admin/options.phpからmedium_large_size_wという項目を見つけて0にする テンプレート テンプレートに引数を渡す $archive_menu_args = array( "type" => "news", ); get_template_part('inc_archive_menu', null, $archive_menu_args); 取得側はたとえばこんな感じ $archive_menu_args['type']

デザイニングナスカはwebデザインなどのweb系、およびDMデザインなどの平面デザインを行っています。

安く、手早く、それなりに。をコンセプトとしてデザイン活動を行っています。
デザイニングナスカという言葉は創立時に多くの知り合いの方のアイデアを元に作った造語です。
この名前をずっと長く使えるように頑張っていきたいと思っています。
サイトメニューを見る ページトップに戻る

Twitter Facebook mail