# SnowMonkey:「最新の記事一覧」に「更新日」を載せる方法(通常は投稿日のみ表示) ◆変更内容 ・SnowMonkeyの「項目ブロック」>「自由入力」使用 ・クライアントの「投稿日を消して更新日のみにして欲しい」という希望で実装 ・投稿日はデフォルトで表示だが、ここではdisplay:noneで非表示に ◆サンプル ・SnowMonkeyの「最新記事一覧」>「テキスト」表示。 ※デフォルトなら更新日は左に表示されるが、CSSで左に(ここでは割愛) ![](https://i.imgur.com/yHVSw4e.jpg) <br> ◆変更ファイル(子テーマ使用) functions.php ``` /** 「最新の記事一覧」に最終更新日を表示 */ add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( 'template-parts/loop/entry-summary/meta/meta' === $slug ) { ob_start(); ?> <li class="c-meta__item c-meta__item--modified"> <svg class="svg-inline--fa fa-sync-alt fa-w-16" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="sync-alt" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M370.72 133.28C339.458 104.008 298.888 87.962 255.848 88c-77.458.068-144.328 53.178-162.791 126.85-1.344 5.363-6.122 9.15-11.651 9.15H24.103c-7.498 0-13.194-6.807-11.807-14.176C33.933 94.924 134.813 8 256 8c66.448 0 126.791 26.136 171.315 68.685L463.03 40.97C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.749zM32 296h134.059c21.382 0 32.09 25.851 16.971 40.971l-41.75 41.75c31.262 29.273 71.835 45.319 114.876 45.28 77.418-.07 144.315-53.144 162.787-126.849 1.344-5.363 6.122-9.15 11.651-9.15h57.304c7.498 0 13.194 6.807 11.807 14.176C478.067 417.076 377.187 504 256 504c-66.448 0-126.791-26.136-171.315-68.685L48.97 471.03C33.851 486.149 8 475.441 8 454.059V320c0-13.255 10.745-24 24-24z"></path></svg> <?php the_modified_time( get_option( 'date_format' ) ); ?> </li> <?php $modifiled = ob_get_clean(); return preg_replace( '|(<li class="c-meta__item c-meta__item--published">.*?</li>)|ms', '$1' . $modifiled, $html ); } return $html; }, 10, 2 ); ```