サイドバーヴィジェットに指定の投稿&カスタム投稿タイプの新着記事を表示-その1

テキストヴィジェットに以下コピペで指定の投稿&カスタム投稿タイプの新着記事を表示出来ます。

アイキャッチ画像なし

日付け入り

<ul>
<?php global $post;
 $mypost = get_posts( array(
 'numberposts' => 5,
 'post_type' => array('post', 'custom1', 'custom2' ));
 foreach( $mypost as $post ) : setup_postdata($post); ?>

<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
<?php wp_reset_postdata(); ?>

日付け入り

<ul>
<?php
     global $post;
     $my_posts= get_posts(array(
     'post_type' => array('post','custom1','custom2'),
     'numberposts' => 10
     ));
     foreach($my_posts as $post):setup_postdata($post);
?>
     <li><?php the_time('Y.m.d'); ?>:<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>

アイキャッチ画像つき

日付入り

<ul>
<?php
     global $post;
     $my_posts= get_posts(array(
     'post_type' => array('post','custom1','custom2'),
     'numberposts' => 10
     ));
     foreach($my_posts as $post):setup_postdata($post);
?>
     <li><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(300,169)); ?></a></br><?php the_time('Y.m.d'); ?>:<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>

日付けなし

<ul>
<?php
     global $post;
     $my_posts= get_posts(array(
     'post_type' => array('post','custom1','custom2'),
     'numberposts' => 10
     ));
     foreach($my_posts as $post):setup_postdata($post);
?>
     <li><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(300,169)); ?></a></br><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>

こちらのページを参考させていただきました。
get_posts()で複数の投稿タイプが混在した記事一覧を作る