I'm trying to get posts from all categories but with one post format, the post format named homePost, I just a beginner in WordPress and I just finished learning the front-end developing and PHP+MySQL developing and I need your help guys :)
Here is my code
<?php $args = array( 'orderby' => 'name', 'parent' => 0 );
$categories = get_categories( $args );
foreach ( $categories as $category ) {
$homePosts = array(
'post_type'=> 'post',
'post_status' => 'publish',
'category' => $category->cat_ID,
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'homePost' )
)
)
);
$asides = get_posts( $homePosts );
if ( count($asides) ) {
foreach ( $asides as $homePosts ) {
'<p>' + 'Test' + '</p>' ;
}
}
}
?>