WordPress カスタムテーマ作成

wordpress header.php ①

language_attributes(); - 公式テーマとして登録する際は必須。個人で使用する場合は <html lang="ja">のままで大丈夫 <title><?php bloginfo('name'); ?></title><meta name="keywords" content="<?php bloginfo('keywords'); ?>"><meta name="description" content="<?php bloginfo('description'); ?>"> </meta></meta></html>

WordPRESS header.php メタ og

・og:type 記事の種類。 content属性値:ブログや、ニュースの記事はarticleと指定。 ------ ・og:title 記事のタイトル。 で記事のタイトルを出力。 ------ ・og:url 記事のURL。 で記事の個別URLを出力。 ------- ・og:description 記事の概要。 で記事の…

コンタクトフォーム7 <script src="https://ajaxzip3.github.io/ajaxzip3.js" charset="UTF-8"></script> <p>郵便番号<br /> [text zip1 3/3 id:zip1] - [text zip2 4/4 id:zip2] </p> <p>都道府県<br /> [text prefecture 80/ id:prefecture]</p> <p>市区町村<br /> [text city 80/ id:city] </p> <p>町域大字・番地<br /> [text street 80/ id:street]…</p>

wordpress メモリンク

・高さをそろえる 参考 [jQuery] レスポンシブ:複数横並びdiv枠の高さを取得、最大値に揃える | ジュウロクデザイン www.webantena.net ---------- ・home.php に固定ページ出力 [WordPress]特定の固定ページの内容を取得して表示する | ホームページ制作 W…

wordpress ショートコード home.phpに出力

ショートコードを do_shortcode() 関数に引数として渡して、その出力を表示する必要があります。次のように: 1

WordPRESS カテゴリー テンプレタグ

single.php ◯記事が属するカテゴリーIDを取得 term_id; } } ?> /* get_the_category()で表示中の記事が属するカテゴリーに関するデータを取得し、IDを取り出して、$catkwdsに代入する。記事が複数の場合カテゴリーに属している場合は、すべてのカテゴリーID…

single.php ページ分岐

<h3 style="margin:5px;padding:0;">関連動画</h3> <div class="gr3 clearfix"> <div> 2, // 表示件数 'category' => 23, // カテゴリIDもしくはスラッグ名 'order' => 'ASC' )); ?> </div></div>

wordpress サムネイル メモ

functions.php /* 再度作成するサムネイルのサイズ設定 */ // 'large-feature'という名前で幅300px、高さ200pxのサムネイルを作成 add_image_size( 'large-feature', 300, 200 ); // 'middle-feature'という名前で幅200px、高さ100pxのサムネイルを作成 add_…

wordpress 文字数制限 PHP mb_strimwidth

1 2 3 4 5 6 //抜粋文の文字制限 add_filter('the_excerpt', 'my_the_excerpt'); function my_the_excerpt($postContent) { $postContent = mb_strimwidth($postContent, 0, 140, "…","UTF-8"); return $postContent; }

wordpress TOP メモ home.php

<div id="main_sec" class="main_section_<?php if ( get_option( 'column_position' ) == 0 ) : ?>0<?php endif; ?><?php if ( get_option( 'column_position' ) == 1 ) : ?>1<?php endif; ?>"> <h1 class="m1">見直し実績 2405社 見直しポイント<…</h1></div>

memo wordpress トップページ

<div id="main_sec" class="main_section_<?php if ( get_option( 'column_position' ) == 0 ) : ?>0<?php endif; ?><?php if ( get_option( 'column_position' ) == 1 ) : ?>1<?php endif; ?>"> <h1 class="m1"></h1> </div>

WordPRESS メモ

index.php <h1 class="m1">事例</h1><div class="container kizi"><section class="gr4 clearfix"> <div <?php post_class(); ?>> <a href="<?php the_permalink(); ?>"> <h2></h2> </a></div></section></div>

WordPRESS カスタムメニュー

functions.php // カスタムメニューregister_nav_menu('sitenav', 'ナビゲーションメニュー'); --------- header.php 'sitenav', #ロケーション名 'container' => 'nav', # HTML タグ 'container_class' => 'mainmenu', # クラス名 'container_id' => 'main…

JavaScript 利用 functions.php

functions.php // JS function menu_scripts() { wp_enqueue_script('menu_script',get_template_directory_uri(). '/menu.js',array('jquery')); } add_action('wp_enqueue_scripts','menu_scripts');

ワードプレス カスタム 抜粋 新着記事 

'post', 'posts_per_page' => '5')); if($myposts): ?> <aside class="amenu"> <h2>最新記事一覧</h2> <ul> <li><a href="<?php the_permalink(); ?>"> </a> </li> </ul></aside>

ワードプレス カスタム functions.php 概要 文字抜粋

// 概要(抜粋)の文字数 function my_length($length) { return 77; } add_filter('excerpt_mblength','my_length'); // 概要(抜粋)の記号 function my_mory($more) { return '...'; } add_filter('excerpt_more','my_more');

WP テンプレートタグ 一覧

// ヘッダー出力 ※index.phpだけに使いた場合 header-index.phpファイルに記述し 出力時: //スタイルシート読み込み <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>"> ※テーマフォルダ直下のstyle.css // フッター出力 // ブログ・サイトのタイトル // ブログ・サ…</link>

funcitons.php 一覧

1000, 'height' => 300, 'hader-text' => false)); // 概要抜粋 文字function my_length($lenght) { return 55;// 文字数}add_filter('excerpt_mylength','my_lenght'); // 概要抜粋の省略記号function my_more($more) { return '...';}add_filter('excerpt…

カスタム機能まとめ

記述場所:functions.php // カスタムヘッダー画像 add_theme_support('custom-header',array( 'width' => 1200, // 横 'height' => 400, // 縦 'header' => false // trueでも )); 出力例:index.php 1: <div style="background-image:url<?php header_image(); ?>"> 2: <div class="A"> </div></div>

WP オリジナルテーマ 1

◯ファイルの準備 フォルダ(テーマ名) フォルダの中にファイル作成 index.php:1番に表示の優先度の高いテンプレート single.php:記事の個別ページ header.php:ヘッダー部分のパーツテンプレート footer.php:フッター部分のパーツテンプレート style.cs…