Sure, I can provide you with the code snippets for calling the latest, random, popular, and specific category posts in WordPress.

WordPress 调用最新、随机、热门、指定分类代码汇总

  1. Latest Posts:
    To display the latest posts, you can use the following code:

    
    <?php
    $args = array(
    'post_type' => 'post',
    'posts_per_page' => 5,
    );

$latest_posts = new WP_Query($args);

if ($latest_posts>have_posts()) :
while ($latest_posts>have_posts()) : $latest_posts>the_post();
// Display post content or title as needed
the_title();
endwhile;
endif;
?>


2. Random Posts:
To display random posts, you can use the following code:
```php
<?php
$args = array(
    'post_type' => 'post',
    'orderby' => 'rand',
    'posts_per_page' => 5,
);

$random_posts = new WP_Query($args);

if ($random_posts>have_posts()) :
    while ($random_posts>have_posts()) : $random_posts>the_post();
        // Display post content or title as needed
        the_title();
    endwhile;
endif;
?>
  1. Popular/Popular Posts:
    Displaying popular posts typically requires a plugin or some sort of tracking mechanism to determine post popularity. You can use plugins like "Jetpack" or "Popular Posts Widget" to achieve this functionality.

  2. Posts from a Specific Category:
    To display posts from a specific category, you can use the following code:

    
    <?php
    $args = array(
    'post_type' => 'post',
    'cat' => 42, // Replace with your category ID
    'posts_per_page' => 5,
    );

$category_posts = new WP_Query($args);

if ($category_posts>have_posts()) :
while ($category_posts>have_posts()) : $category_posts>the_post();
// Display post content or title as needed
the_title();
endwhile;
endif;
?>


Replace 42 with the ID of the desired category.

Make sure to customize these snippets according to your specific requirements and theme structure.