Php Wordpress主题修改显示额外模块
谢谢你看我的问题。我有一个模板,它在一个3乘3的块中显示帖子,我正在尝试将其扩展到4乘3,我如何才能做到这一点?我已经设法让它在底部创建了一个额外的行,但我在寻找一个额外的列 问题代码如下:Php Wordpress主题修改显示额外模块,php,html,wordpress,Php,Html,Wordpress,谢谢你看我的问题。我有一个模板,它在一个3乘3的块中显示帖子,我正在尝试将其扩展到4乘3,我如何才能做到这一点?我已经设法让它在底部创建了一个额外的行,但我在寻找一个额外的列 问题代码如下: <div class="col-xs-12 col-sm-9 col-md-9 col-lg-9"> <div class="row row-adj-gap"> <?php $args = array( 'post_type' => 'po
<div class="col-xs-12 col-sm-9 col-md-9 col-lg-9">
<div class="row row-adj-gap">
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 9
);
query_posts( $args );
if ( have_posts() ):
$lp_cntr = 0;
while ( have_posts() ) :
the_post();
$lp_cntr++;
?>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
<div class="hvr-wobble-horizontal full-div">
<a href="<?php get_date(); ?>" class="coverBox">
<img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>" class="img-responsive" alt="<?php the_title(); ?>">
<span><i class="fa fa-braille" aria-hidden="true"></i><?php the_title(); ?></span>
</a>
<div class="desp-box">
<?php the_content(); ?>
</div>
</div>
</div>
<?php if($lp_cntr%3==0): ?>
</div>
<div class="row row-adj-gap">
<?php endif; ?>
<?php
endwhile;
endif;
wp_reset_query();
?>
</div>
您需要:
- 通过更改post块上的列大小来减小块宽度(
,col-sm-4
,col-md-4
变为col-lg-4
,col-sm-3
)和col-md-3
- 通过更改行调制(每行post)计数器增加每行post块数(
变为$lp\u cntr%3==0
)$lp\u cntr%4==0
<div class="col-xs-12 col-sm-9 col-md-9 col-lg-9">
<div class="row row-adj-gap">
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 9
);
query_posts( $args );
if ( have_posts() ):
$lp_cntr = 0;
while ( have_posts() ) :
the_post();
$lp_cntr++;
?>
/* Change the following line to decrease block width: */
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
<div class="hvr-wobble-horizontal full-div">
<a href="<?php get_date(); ?>" class="coverBox">
<img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>" class="img-responsive" alt="<?php the_title(); ?>">
<span><i class="fa fa-braille" aria-hidden="true"></i><?php the_title(); ?></span>
</a>
<div class="desp-box">
<?php the_content(); ?>
</div>
</div>
</div>
/* Change the following line to increase posts in a row before a break: */
<?php if($lp_cntr%4==0): ?>
</div>
<div class="row row-adj-gap">
<?php endif; ?>
<?php
endwhile;
endif;
wp_reset_query();
?>
</div>
/*更改以下行以减小块宽度:*/
/*更改以下行以在中断前增加行中的立柱:*/
您需要:
- 通过更改post块上的列大小来减小块宽度(
,col-sm-4
,col-md-4
变为col-lg-4
,col-sm-3
)和col-md-3
- 通过更改行调制(每行post)计数器增加每行post块数(
变为$lp\u cntr%3==0
)$lp\u cntr%4==0
<div class="col-xs-12 col-sm-9 col-md-9 col-lg-9">
<div class="row row-adj-gap">
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 9
);
query_posts( $args );
if ( have_posts() ):
$lp_cntr = 0;
while ( have_posts() ) :
the_post();
$lp_cntr++;
?>
/* Change the following line to decrease block width: */
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
<div class="hvr-wobble-horizontal full-div">
<a href="<?php get_date(); ?>" class="coverBox">
<img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>" class="img-responsive" alt="<?php the_title(); ?>">
<span><i class="fa fa-braille" aria-hidden="true"></i><?php the_title(); ?></span>
</a>
<div class="desp-box">
<?php the_content(); ?>
</div>
</div>
</div>
/* Change the following line to increase posts in a row before a break: */
<?php if($lp_cntr%4==0): ?>
</div>
<div class="row row-adj-gap">
<?php endif; ?>
<?php
endwhile;
endif;
wp_reset_query();
?>
</div>
/*更改以下行以减小块宽度:*/
/*更改以下行以在中断前增加行中的立柱:*/
只需将列类别col-xs-12 col-sm-4 col-md-4 col-lg-4 in更改为
col-xs-12 col-sm-3 col-md-3 col-lg-3只需将列类col-xs-12 col-sm-4 col-md-4 col-lg-4 in更改为 col-xs-12 col-sm-3 col-md-3 col-lg-3