Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.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
Wordpress 有人吗?_Wordpress_Wordpress Theming - Fatal编程技术网

Wordpress 有人吗?

Wordpress 有人吗?,wordpress,wordpress-theming,Wordpress,Wordpress Theming,我想知道是否有任何方法可以使用WordPress post计数器使用相同的css类显示最多10篇文章,我在下面的代码中制作了一篇,但是它只显示了两篇,当我制作第4篇文章时,它没有遵守我创建的css规则。 这就是我走了多远 <div class="col-md-12 featt big-grid"> <div class="container-fluid no-padding"> <?php $args = array( 'post_type' =&g

我想知道是否有任何方法可以使用WordPress post计数器使用相同的css类显示最多10篇文章,我在下面的代码中制作了一篇,但是它只显示了两篇,当我制作第4篇文章时,它没有遵守我创建的css规则。 这就是我走了多远

<div class="col-md-12 featt big-grid">
<div class="container-fluid no-padding">
  <?php
  $args = array(
    'post_type' => '',
    'category_name' => '',
    'posts_per_page' => '2'
  );
  $query = new WP_Query( $args );
  if ( $query->have_posts()) : 
    $i = 0; 

    while( $query->have_posts() ) : 
      $query->the_post();
    $i++;
        if($i <= 2) {
          if($i == 1) {
  ?>
            <div class="big-pane col-xs-6">
            <div class="the-big-pane image">
            <?php the_post_thumbnail();?>
            </div>
            <div class="big-pane overlay">

              <div class="the-big-pane-content">
               <div class="the-cont-cat">
  <span class="the-content-cat-bt">  <?php $category = get_the_category(); if ($category) 
                { echo wp_kses_post('<a href="' . get_category_link( $category[0]->term_id ) . '" class="tiptipBlog" title="' . sprintf( esc_html__( "View all posts in %s", "acardio" ), $category[0]->name ) . '" ' . '>' . $category[0]->name.'</a> ');}  ?></span>  <span class="the-content-cat-bt"> <?php taqyeem_get_score(); ?> </span>
 </div>
                <h1><a href="<?php the_permalink(); ?>"><?php the_title(); echo" ".$i?></a></h1>
                <span class="the-content-post-data"><span class="the-auth-post-image-content" style="padding-top: 0px !important;"> <?php echo get_avatar( get_the_author_meta( 'user_email' ), 100 ); ?> </span> By <a href="#"><?php the_author_posts_link(); ?></a> <span class="the-content-post-date"> <i class="fa fa-clock-o the-content "></i><?php the_time('jS M, Y') ?></span> </span>
              </div>
            </div>
            </div>

            <div class="big-pane col-xs-6">
            <?php 
            } 
          else { ?>
            <div class="the-big-pane image">
            <?php the_post_thumbnail();?>
            </div>
            <div class="big-pane overlay">

              <div class="the-big-pane-content">
               <div class="the-cont-cat">
   <span class="the-content-cat-bt">  <?php $category = get_the_category(); if ($category) 
                { echo wp_kses_post('<a href="' . get_category_link( $category[0]->term_id ) . '" class="tiptipBlog" title="' . sprintf( esc_html__( "View all posts in %s", "acardio" ), $category[0]->name ) . '" ' . '>' . $category[0]->name.'</a> ');}  ?></span>  <span class="the-content-cat-bt"> <?php taqyeem_get_score(); ?> </span>
   </div>
                <h1><a href="<?php the_permalink(); ?>"><?php the_title(); echo" ".$i?></a></h1>
                <span class="the-content-post-data"><span class="the-auth-post-image-content" style="padding-top: 0px !important;"> <?php echo get_avatar( get_the_author_meta( 'user_email' ), 100 ); ?> </span> By <a href="#"><?php the_author_posts_link(); ?></a> <span class="the-content-post-date"> <i class="fa fa-clock-o the-content "></i><?php the_time('jS M, Y') ?></span> </span>
              </div>
            </div>
            </div>

            <?php 
            if($i == 2){ ?> 
              </div>

              <?php 
            }
          }
        }


    endwhile; 
    else: 
      echo "<p>Sorry no post found :(!</p>"; 
  endif; 
  wp_reset_postdata(); ?>               
   </div>           

通过
通过

您需要更改此设置

 $args = array(
    'post_type' => '',
    'category_name' => '',
    'posts_per_page' => '2'
  );
以反映每页帖子中的帖子数量

 $args = array(
    'post_type' => '',
    'category_name' => '',
    'posts_per_page' => '10'
  );

不起作用,兄弟,我认为页面计数器阻止了它,我认为一个理想的解决方法是将post计数器设置为>(大于)两个预定义样式。因此>2,但我不知道该怎么做。