This file contains 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
<table> | |
<tr> | |
<th>日付</th> | |
<th>タイトル</th> | |
</tr> | |
<?php | |
$postcount = 1; //奇数偶数をカウント | |
$news = get_posts( array( | |
'post_type' => 'type', | |
'posts_per_page' => -1, |
This file contains 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 | |
//HTMLの自動整形を解除 | |
function set_allowedposttags($content){ | |
global $allowedposttags; | |
$allowedposttags['dl'] = array( | |
'class' => array(), | |
'id' => array() | |
); | |
$allowedposttags['dt'] = array( | |
'class' => array(), |
This file contains 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
<dl> | |
<?php | |
$news = get_posts( array( | |
'posts_per_page' => 20, | |
'order' => 'ASC', //ASC/*DESC | |
'orderby' => 'ID', //ID/author/title/date/modified/parent/rand/comment_count/menu_order/meta_value/meta_value_num | |
'category_name' => 'slug', | |
'tag' => 'slug' | |
'post_type' => 'slug', | |
'taxonomy' => 'slug', |
This file contains 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> |
This file contains 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 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 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 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 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 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> |
OlderNewer