Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 显示最近发布的WP自定义主题_Php_Wordpress - Fatal编程技术网

Php 显示最近发布的WP自定义主题

Php 显示最近发布的WP自定义主题,php,wordpress,Php,Wordpress,我在发布关于我的WP自定义主题的最新帖子时遇到问题。我有以下代码: <?php if ( have_posts()) : <?php if ( have_posts()) : $posts_count =wp_count_posts()->publish; $args = array( 'post_type' => 'post','posts_per_page' => 2, 'ignore_st

我在发布关于我的WP自定义主题的最新帖子时遇到问题。我有以下代码:

<?php   if ( have_posts()) :            
<?php   if ( have_posts()) :            
    $posts_count =wp_count_posts()->publish;
    $args = array( 'post_type' => 'post','posts_per_page' => 2, 'ignore_sticky_posts' => 1, 'orderby' => 'ID', 'post__in' => array(667, 669));      
    $post_type_data = new WP_Query( $args );
    while($post_type_data->have_posts()):
    $post_type_data->the_post(); ?>
    <div class="col-md-4 col-sm-12 scrollimation scale-in d2 pull-left">
    <div class="enigma_blog_thumb_wrapper">
        <div class="enigma_blog_thumb_wrapper_showcase">                    
            <?php $img = array('class' => 'enigma_img_responsive');
                    if(has_post_thumbnail()): 
                    the_post_thumbnail('home_post_thumb',$img);
            endif; ?>
            <div class="enigma_blog_thumb_wrapper_showcase_overlay">
                <div class="enigma_blog_thumb_wrapper_showcase_overlay_inner ">
                    <div class="enigma_blog_thumb_wrapper_showcase_icons">
                        <a title="<?php the_title_attribute(); ?>" href="<?php the_permalink(); ?>"><i class="fa fa-link"></i></a>

将查询更改为

 $args = array( 
          'post_type' => 'post',
          'posts_per_page' => 2, 
          'ignore_sticky_posts' => 1
          );      
或使用