Title: skon08の返信 | WordPress.org 日本語

---

# skon08

  [  ](https://ja.wordpress.org/support/users/skon08/)

 *   [プロフィール](https://ja.wordpress.org/support/users/skon08/)
 *   [作成したトピック](https://ja.wordpress.org/support/users/skon08/topics/)
 *   [作成した返信](https://ja.wordpress.org/support/users/skon08/replies/)
 *   [返信したトピック](https://ja.wordpress.org/support/users/skon08/replied-to/)
 *   [エンゲージメント](https://ja.wordpress.org/support/users/skon08/engagements/)
 *   [お気に入り](https://ja.wordpress.org/support/users/skon08/favorites/)

 返信を検索

## フォーラムへの返信

3件の返信を表示中 - 1 - 3件目 (全3件中)

 *   フォーラム: [使い方全般](https://ja.wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   返信が含まれるトピック: [アイキャッチ及び投稿内容が連続してしまう](https://ja.wordpress.org/support/topic/%e3%82%a2%e3%82%a4%e3%82%ad%e3%83%a3%e3%83%83%e3%83%81%e5%8f%8a%e3%81%b3%e6%8a%95%e7%a8%bf%e5%86%85%e5%ae%b9%e3%81%8c%e9%80%a3%e7%b6%9a%e3%81%97%e3%81%a6%e3%81%97%e3%81%be%e3%81%86/)
 *  トピック投稿者 [skon08](https://ja.wordpress.org/support/users/skon08/)
 * (@skon08)
 * [12年、 6ヶ月前](https://ja.wordpress.org/support/topic/%e3%82%a2%e3%82%a4%e3%82%ad%e3%83%a3%e3%83%83%e3%83%81%e5%8f%8a%e3%81%b3%e6%8a%95%e7%a8%bf%e5%86%85%e5%ae%b9%e3%81%8c%e9%80%a3%e7%b6%9a%e3%81%97%e3%81%a6%e3%81%97%e3%81%be%e3%81%86/#post-175660)
 * jim912 様
    kz 様
 * 出来ました！！単純に endif が抜け落ちていただけでしたね、お恥ずかしい…
    あと、
   h2 タグ内の $latest_events も $post に入れ替える必要があったのですね。
 * ご面倒をお掛けいたしましたが、おかげ様で完全に意図していた内容となりました。
   
   本当にありがとうございました！！
 * 今後とも、どうぞ宜しく御願いいたします。
 *   フォーラム: [使い方全般](https://ja.wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   返信が含まれるトピック: [アイキャッチ及び投稿内容が連続してしまう](https://ja.wordpress.org/support/topic/%e3%82%a2%e3%82%a4%e3%82%ad%e3%83%a3%e3%83%83%e3%83%81%e5%8f%8a%e3%81%b3%e6%8a%95%e7%a8%bf%e5%86%85%e5%ae%b9%e3%81%8c%e9%80%a3%e7%b6%9a%e3%81%97%e3%81%a6%e3%81%97%e3%81%be%e3%81%86/)
 *  トピック投稿者 [skon08](https://ja.wordpress.org/support/users/skon08/)
 * (@skon08)
 * [12年、 6ヶ月前](https://ja.wordpress.org/support/topic/%e3%82%a2%e3%82%a4%e3%82%ad%e3%83%a3%e3%83%83%e3%83%81%e5%8f%8a%e3%81%b3%e6%8a%95%e7%a8%bf%e5%86%85%e5%ae%b9%e3%81%8c%e9%80%a3%e7%b6%9a%e3%81%97%e3%81%a6%e3%81%97%e3%81%be%e3%81%86/#post-175656)
 * kz 様
 * アドバイス頂き、ありがとうございます、お世話になります。
    また、ご連絡が遅くな
   ってしまい、申し訳ございません。
 * ご提示頂いた構文を組み込んだところ、syntax error から抜け出せなくなってしまいま
   した…。
    33行目（jim912 様にご教示頂いた endforeach の構文）でエラーを吐いている
   のですが、 何が問題であるのか、PHP 初心者の当方には見当も付きません…。
 * 一応、現状の content.php を下記させて頂きます。
    ※なお、function.php　には修正
   は加えていません。
 *     ```
       <?php $latest_events = get_latest_events(); if ( $latest_events ) : ?>
       	<?php foreach ( $latest_events as $post ) :
       	setup_postdata( $post );
       	$start_day = get_post_meta( $latest_event->ID, 'date', true );
       	$end_day = get_post_meta( $latest_event->ID, 'date', true );
       	$end_day = $end_day ? $end_day : $start_day;
       	?>
   
       	<div class="post">
       	<h2><a href="<?php echo get_permalink( $latest_event->ID ); ?>" title="<?php echo attribute_escape( strip_tags( $latest_event->post_title ) ); ?>"><?php echo wp_specialchars( strip_tags( apply_filters( 'the_title', $latest_event->post_title ) ) ); ?></a>
       	</h2>
   
       	<p class="postcat">
       	<?php the_category(' '); ?>
       	</p>
   
       	<p class="thumb">
       	<?php if(has_post_thumbnail()): ?>
       	<?php echo get_the_post_thumbnail(); ?>
   
       	<?php else: ?>
       	<img src="<?php bloginfo('template_url'); ?>/no_image.jpg" alt="No Image" width="150" height="150" />
       	<?php endif; ?>
   
       	</p>
   
       	<?php the_excerpt(); ?>
   
       	<p class="more"><a href="<?php the_permalink(); ?>">詳細を確認する</a></p>
   
       	</div>
   
       <?php endforeach; wp_reset_postdata(); ?>
       ```
   
 * ヒントをご教示いただくことは可能でしょうか。
 * お手数ばかりお掛けし、大変恐縮です。
    もう暫く、お付き合い頂けますと幸いです。
   どうぞ、宜しく御願いいたします。
 *   フォーラム: [使い方全般](https://ja.wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   返信が含まれるトピック: [アイキャッチ及び投稿内容が連続してしまう](https://ja.wordpress.org/support/topic/%e3%82%a2%e3%82%a4%e3%82%ad%e3%83%a3%e3%83%83%e3%83%81%e5%8f%8a%e3%81%b3%e6%8a%95%e7%a8%bf%e5%86%85%e5%ae%b9%e3%81%8c%e9%80%a3%e7%b6%9a%e3%81%97%e3%81%a6%e3%81%97%e3%81%be%e3%81%86/)
 *  トピック投稿者 [skon08](https://ja.wordpress.org/support/users/skon08/)
 * (@skon08)
 * [12年、 6ヶ月前](https://ja.wordpress.org/support/topic/%e3%82%a2%e3%82%a4%e3%82%ad%e3%83%a3%e3%83%83%e3%83%81%e5%8f%8a%e3%81%b3%e6%8a%95%e7%a8%bf%e5%86%85%e5%ae%b9%e3%81%8c%e9%80%a3%e7%b6%9a%e3%81%97%e3%81%a6%e3%81%97%e3%81%be%e3%81%86/#post-175573)
 * ご本人に来ていただけるとは！
    ご返答ありがとうございます、お世話になります。
 * content.php 内にて、
 *     ```
       (中略)
       	<?php foreach ( $latest_events as $latest_event ) :
       	setup_postdata( $latest_event );
       	$start_day = get_post_meta( $latest_event->ID, 'date', true );
       	(中略)
       ```
   
 * ということでしょうか。
    endforeach も修正したのですが、結果は変わりませんでした。
 * 1点、申し忘れていた仕様がございまして、
    本件では、下記例のように3種の固定カテゴリ
   を使用しています。(※スラッグは使用していません。) カテゴリも同様に、「記事B」
   のものが並んでいる状態となっています。 例: DDDDD、EEEEE、FFFFFF
 * 何に被疑がおかれているのか、検索もしたのですが、解決策が見当たりません。
    引き続き、
   アドバイスをご教示頂けると大変心強いです。

3件の返信を表示中 - 1 - 3件目 (全3件中)