teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

追記2

2017/04/10 13:10

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -44,7 +44,7 @@
44
44
  <div class="post-fig">
45
45
  <?php the_automatic_thumbnail_url(get_template_directory_uri()."/common/img/base/noimage_xl.png", "tmb_cut_760x450"); ?>
46
46
  </div>
47
- <p class="tbborder-txt mincho">SMILE KOUEI通信</p>
47
+ <p class="tbborder-txt mincho">SMILE</p>
48
48
  <p class="time"><?php the_time("Y.m.d"); ?></p>
49
49
  <h2><?php the_title(); ?></h2>
50
50
  <?php if($counter == 0): ?>

1

追記

2017/04/10 13:09

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -26,4 +26,37 @@
26
26
  これでもできず、調べてみても上のやり方しか出てきません。
27
27
 
28
28
  WordPressに詳しい方ご教示いただければと思います。
29
- よろしくお願いいたします。
29
+ よろしくお願いいたします。
30
+
31
+ テンプレート
32
+ ```php
33
+ <?php
34
+ $args = array(
35
+ "post_type"=>"smile",
36
+ "post_per_page"=>2,
37
+ );
38
+ $the_query = new WP_Query($args);
39
+ $counter = 0;
40
+ if($the_query->have_posts()):
41
+ while($the_query->have_posts()): $the_query->the_post(); ?>
42
+ <li class="grid <?php echo ($counter == 0) ? 'first':'normal'; ?>">
43
+ <a href="<?php the_permalink(); ?>">
44
+ <div class="post-fig">
45
+ <?php the_automatic_thumbnail_url(get_template_directory_uri()."/common/img/base/noimage_xl.png", "tmb_cut_760x450"); ?>
46
+ </div>
47
+ <p class="tbborder-txt mincho">SMILE KOUEI通信</p>
48
+ <p class="time"><?php the_time("Y.m.d"); ?></p>
49
+ <h2><?php the_title(); ?></h2>
50
+ <?php if($counter == 0): ?>
51
+ <div class="ex"><?php echo nl2br(get_the_excerpt()); ?></div>
52
+ <?php endif; ?>
53
+ <div class="gray-switch">
54
+ <span>詳しくはこちら</span>
55
+ </div>
56
+ </a>
57
+ </li>
58
+ <?php $counter++; ?>
59
+ <?php endwhile; ?>
60
+ <?php endif; ?>
61
+
62
+ ```