This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ※keyname の部分は作成したカスタムフィールドの名前に置き換える | |
| そのまま出力 | |
| <?php echo $post->keyname; ?> | |
| または | |
| <?php echo $post->{keyname}; ?> | |
| HTMLをエスケープしたい場合 | |
| <?php echo esc_html( $post->keyname ); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 別途HTML側で以下のスクリプトを読み込む。 | |
| <script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
| <script type="text/javascript" src="js/googlefeed.js"></script> | |
| また、フィードを表示させたい箇所に | |
| <div id="feed"><p>Now Loading...</p></div> | |
| を置く。 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1><img src="<?php echo esc_url( get_template_directory_uri() ); ?>/images/title_<?php echo esc_attr( $post->post_name ); ?>.jpg" alt="<?php the_title_attribute(); ?>" /></h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php if(is_category()): ?> | |
| <?php | |
| $cat_id = get_query_var('cat'); | |
| $cat = get_category($cat_id); | |
| $cat_parent_id = $cat->category_parent; | |
| $cat_parent = get_category($cat_parent_id); | |
| if( $cat_parent_id == 0 ): //親カテゴリの場合 | |
| $cat_parent = get_category($cat_parent_id); | |
| ?> | |
| <p class="title"><img src="<?php echo get_template_directory_uri(); ?>/images/title_<?php echo $cat->category_nicename; ?>.jpg" alt="<?php single_cat_title(); ?>" /></p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $cat = get_the_category(); | |
| if ($cat[0]->category_parent): //子カテゴリの場合 | |
| $parent_cat = get_category($cat[0]->category_parent); | |
| ?> | |
| <p class="title"><img src="<?php echo get_template_directory_uri(); ?>/images/title_<?php echo $parent_cat->slug; ?>.jpg" alt="<?php echo $parent_cat->name; ?>" /></p> | |
| <p class="subtitle"><?php echo $cat[0]->cat_name; ?></p> | |
| <?php else: //親カテゴリの場合 ?> | |
| <p class="title"><img src="<?php echo get_template_directory_uri(); ?>/images/title_<?php echo $cat[0]->category_nicename; ?>.jpg" alt="<?php echo $cat[0]->cat_name; ?>" /></p> | |
| <?php endif; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php if ( has_post_thumbnail() ) : ?> | |
| <a href="<?php | |
| $popupimg_id = get_post_thumbnail_id(); | |
| $popupimg_url = wp_get_attachment_image_src($popupimg_id,'full', true); | |
| echo esc_url($popupimg_url[0]); | |
| ?>"><?php the_post_thumbnail(); ?></a> | |
| <?php endif; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //以下3行の項目を任意に変更 | |
| $display_posts_count = 5; //実際に表示したい記事件数 | |
| $get_posts_count = 10; //取得する記事件数(PR記事を含むので$display_posts_countより少し多めに設定) | |
| $feed = fetch_feed('http://feedblog.ameba.jp/rss/ameblo/**blogname**/rss20.xml'); //取得したいRSS | |
| // | |
| $counter = 0; //ループ回数カウンター | |
| include_once(ABSPATH . WPINC . '/feed.php'); | |
| if (!is_wp_error( $feed ) ) : //エラーがなければ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //カスタム投稿タイプ作成 | |
| function mypace_custom_post_type() { | |
| register_post_type( 'voice', array( | |
| 'label' => 'お客様の声', | |
| 'public' => true, | |
| 'exclude_from_search' => false, | |
| 'hierarchical' => false, | |
| 'menu_position' => 5, | |
| 'has_archive' => true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $taxonomies = get_terms( | |
| 'faqcategory',array( | |
| 'orderby' => 'slug', | |
| 'order' => 'ASC' | |
| )); | |
| foreach($taxonomies as $taxonomy) : | |
| ?> | |
| <div class="parentBox"> | |
| <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <select name="pref"> | |
| <option value="">お選びください</option> | |
| <optgroup label="北海道・東北"> | |
| <option value="北海道">北海道</option> | |
| <option value="青森県">青森県</option> | |
| <option value="岩手県">岩手県</option> | |
| <option value="宮城県">宮城県</option> | |
| <option value="秋田県">秋田県</option> | |
| <option value="山形県">山形県</option> | |
| <option value="福島県">福島県</option> |