柴田さんよりいただいた。
これは便利!!
<?php
$args = array(
'category_name' => 'info', //表示したいカテゴリー名を入力
'posts_per_page' => 10 //表示件数
);
?>
<?php $posts = get_posts($args); ?>
<?php foreach($posts as $post): ?>
<?php setup_postdata($post); ?>
<div class="col-12 col-xl-12 newsline pt-3">
<a href="<?php the_permalink(); ?>">
<p><?php the_time("Y.n.j") ; ?> <?php the_title(); ?></p>
</a>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
獅子魂のpage-top.php
<div class="col-12 RssContainer mt-1">
<div id="rss">
<?php
$args = array(
'category_name' => 'info', //表示したいカテゴリー名を入力
'posts_per_page' => 10 //表示件数
);
?>
<?php $posts = get_posts($args); ?>
<?php foreach($posts as $post): ?>
<?php setup_postdata($post); ?>
<div class="col-12 col-xl-12 newsline pt-3">
<a href="<?php the_permalink(); ?>">
<p><?php the_time("Y.n.j") ; ?> <?php the_title(); ?></p>
</a>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
</div>
</div>