我看到两个问题:改变aside
到post-format-aside
由于您使用的是foreach循环更改new WP_Query( $singargs );
到get_posts( $singargs );
因此,您的代码应该如下所示:
<?php
$singargs = array(
\'numberposts\' => 1,
\'tax_query\' => array(
\'relation\' => \'AND\',
array(
\'taxonomy\' => \'category\',
\'field\' => \'slug\',
\'terms\' => array ( \'gift-of-the-day\' ),
),
array(
\'taxonomy\', => \'post_format\',
\'field\' => \'slug\',
\'terms\' => array( \'post-format-aside\'),
)
)
);
$singPost = get_posts( $singargs );
foreach ( $singPost as $post ) : setup_postdata($post); ?>
<aside>
<h2><?php the_title(); ?></h2>
</aside>
<?php endforeach; wp_reset_postdata(); ?>