WordPRESS テンプレ コピペ用

wp カスタムヘッダー funcitons.php

funcitons.php /*--------- カスタムヘッダー 開始 -------------*/ # ヘッダー画像add_theme_support('custom-header', array( 'width' => 1120, 'height' => 380, 'header-text' => false));

Wp カスタム投稿フィールド グーグルマップ自動設置機能 めも

/*-----カスタムフィールド 方法 2 --------*/ /*-----カスタムフィールド 方法 2 --------*/ // 固定カスタムフィールドボックスfunction add_shrine_fields() { //add_meta_box(表示される入力ボックスのHTMLのID, ラベル, 表示する内容を作成する関数名, …

wp コピペ用  sidebar.php

<div class="profile"> </div> 'post', 'post_per_page' => '5')); if($myposts) : ?> <aside class="mymenu"><h2>最新記事一覧</h2><ul> <li></li></ul></aside>

wp header.php コピペ用

<html lang="ja"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <meta name="description" content=""> <meta name="author" content=""> </meta></meta></meta></meta></meta></head></html>

Wordpress カスタム投稿タイプ ② functions.php と テンプレート.phpで設定

// カスタムポストタイプ 02function my_post_type02(){ register_post_type( 'a_shrine', array( 'label' => '神社', 'description' => '神社の情報', 'hierarchical' => false, 'public' => true, 'has_archive' => true, 'supports' => array( 'title', #…

wp パンくずリスト

single.php ----- <div class="sub-header"> <div class="bread"><ol> <li><a href="<?php echo home_url(); ?>"> <i class="fa fa-home"></i><span>TOP</span></a></li> <li> </li></ol></div></div>

wp グローバルナビゲーション li デフォルト削除

functions.php /* ナビゲーション liのクラス削除 */add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1);add_filter('nav_menu_item_id', 'my_css_attributes_filter', 100, 1);add_filter('page_css_class', 'my_css_attributes_filter…

wp ループメモ コピペ用

<div><ul> 1 // 表示件数の指定 ); $posts = get_posts( $args );foreach ( $posts as $post ): // ループの開始 setup_postdata( $post ); // 記事データの取得 ?> <li class="top-news"><a href="<?php the_permalink(); ?>"></a></li></ul></div>

Wordpress WP_Query

'post', // 投稿記事だけを指定 'posts_per_page' => '3', // 最新記事を3件表示 ); $the_query = new WP_Query($args); if($the_query->have_posts()) : ?><section class="recentEntries"> <h1 class="type-C">最新記事</h1> <div class="entries"> have_posts…</div></section>

Wordpress 404.php

<div class="contentsWrap"> <div class="mainContents oneColumn"> <article class="page"> <h1 class="type-A">404 Not Found</h1> <section class="content" style="padding:50px 0 100px;"> <p class="aligncenter">お探しのページが見つかりませんでした。</p> <p class="aligncenter">申し訳ございませんが、</p></section></article></div></div>

Wordpress search.php searchform.php 全検索

searchform.php ---------- <div class="search-box"><form role="search" method="get" id="searchform" action="<?php bloginfo( 'url' ); ?>"> <input type="text" value="" name="s" class="s" /> <input type="submit" class="s-btn" value="検索"> </form></div> search.php ----------

Wordpress 検索フォーム

<form action="<?php echo home_url('/'); ?>" method="get" class="searchform"> <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" placeholder="サイト内検索"> <input type="submit" id="searchSubmit" value=""> </form> ・form action => トップページURL ・method => get ・input value =>

Wordpress グローバルナビゲーション 作成

functions.php ----- // カスタムメニュー機能を有効にするadd_theme_support('menus'); ------ 出力 ・wp_nav_menu 'g-nav', // 管理画面で作成したメニューの名前 'container' => false, // <ul> タグを囲んでいる <div> タグを削除 ); wp_nav_menu($args); ?></div></ul>

Wordpress ショートコード作成 & 関数 01

fuctions.php ################ 会社概要 ショートコードfunction shortcode_kaisya() { return '<p class="telimg"><img src="' . get_template_directory_uri() . '/img/contactbnr.jpg"></p>' ; // よくある、オペレータの女性の画像と電話番号、FAX番号などが記載さた画像}add_shortcode('tel', 'shortcode_kaisya'); 使い方 エディターに、 [tel] …

Wordpress 条件分岐タグ コピペ用

------------------ ------------------

WP css スマホ テンプレート コンタクトフォーム 7です。

<div class="contact"><div class="contact"> <ul> <li>貴社名・団体名<span class="nok">*</span>[text* text-kaisya placeholder "株式会社〇〇"]</li> <li>お名前[text text-name placeholder "貨物 太郎"]</li> <li>電話番号[tel tel-712 placeholder "03-0000-0000"]</li> <li>メールアドレス<span class="nok">*</span>[url* url-319 placeholder "ka…</li></ul></div></div>

jQUery メニュー スマホ 

index.html <html lang="ja"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="css/style.css"> </link></meta></meta></meta></head></html>

WP 固定ページテンプレート

----- 2: ファイル名をスラッグにする 例:スラッグ -> new page-new.php ------ 3:ファイル名をIDにする page-3.php

サムネの関数化

functions.php ---- function mythumb($size) { if(has_post_thumbnail()) { $postthumb = wp_get_attachment_image_src(get_post_thumbnail_id(), $size); $url = $postthumb[0]; } else { $url = get_template_directory_uri(). /'no-img.jpg'; } return $…

同じカテゴリー出力

'post', 'post_per_page' => '4', 'post__not_in' => array($post->ID), // 表示中の記事は出力対象から除外するため 'orderby' …

サムネサイズ

funcitons.php --- // サムネサイズfunction display_image($field_name, $size = 'medium') { $image = get_field($field_name); if(!empty($image)) { $url = $image['sizes'][$size]; // 画像URL $width = $image['sizes'][$size . '-width']; //画像の横…

sidebar.php 新着情報 & 人気記事

functions.php register_nav_menu('pickupnav', 'おすすめ記事'); ------ sidebar.php <style>/* サイドバー 新着 */.mymenu h2 {margin-top: 0; margin-bottom: 10px; border-bottom: 2px solid #dddddd; color:#666666; font-size:14px;}.mymenu ul {margin:0; pa…

スマホ スライドボタン JS

nav.js jQuery(function(){ jQuery('#openbtn').click(function(){ jQuery('#mainmenu').slideToggle(); }); }); ---- functions.php // トグルbtn function navbtn_scripts() { wp_enqueue_script('navbtn-script', get_template_directory_uri() . '/nav.j…

WordPRESS single.php previous_post_link(), next_post_link()

<nav class="postNavi"> <span class="prev"> </span> <span class="next"> </span> </nav>

WordPRESS 日付別 条件分岐タグ

・日付別アーカイブページが表示されている場合(例:月、年、日、時間) is_data() ----- ・年別アーカイブが表示されている場合 is_year() ----- ・月別アーカイブページが表示されている場合 is_month() ----- ・日別のアーカイブが表示されている場合 is…

WordPRESS サムネイル

<div class="th_img_top"> <figure> <a href="<?php the_permalink(); ?>"></a> <a href="<?php the_permalink(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/noimage_180x180.png" height="180" width="180"></a> …</figure></div>

テンプレートパーツの読み込み 作成

loop-main.phpを読み込む 任意のテンプレート名-任意の名前.php get_template_part('loop', 'main');

sidebar.php 月別アーカイブ 表示

single.php ------ ------ sidebar-archives.php <ul> 'monthly', // 月別を指定 'show_post_count' => true, // 投稿数を表示 ); wp_get_archives($args); ?> </ul>

WordPRESS カスタム投稿設定  カスタム構造

・投稿された日を取得する %day% ----- ・投稿された月を取得する %monthnum% ----- ・投稿された年を4桁で取得 %year% ----- ・投稿された時間 %hour% ----- ・投稿、固有のID取得 %post_id% ----- ・投稿の投稿名を取得する %postname% ----- ・投稿され…

WordPRESS テンプレ コピペ用

<img src="<?php echo get_template_directory_uri(); ?>/img/" alt=""> ---- <p></p> ----- <title> -----