我正在尝试将我的Wordpress搜索结果样式化,以便它们出现在列中(每行3列),但不知怎么的,它不起作用。也许你能帮我?我在googled上搜索了这个问题,并尝试将while循环放在行div中,但这是行不通的。网站是:www.medical-promotion.de
谢谢你的帮助!)
下面是主题提供的代码。
<?php
/**
* Search
*/
?>
<?php get_header(); ?>
<section class="site-content">
<div class="container">
<?php if( have_posts()) : ?>
<div class="row">
<?php while ( have_posts()) : the_post(); ?>
<div class="col-lg-4 col-sm-4 col-xs-12">
<div class="blog_large">
<?php
$aneeq_post_slide = get_post_meta( $post->ID, 'aneeq_all_post_slides_settings_'.$post->ID, true);
//blog option settings
$aneeq_option_settings = get_option('aneeq_blog_settings');
//feature img url
$aneeq_url = wp_get_attachment_url( get_post_thumbnail_id($post->ID), 'thumbnail' );
?>
<article class="post">
<figure class="post_img">
<a href="<?php the_permalink(); ?>">
<?php if($aneeq_url != NULL) { the_post_thumbnail(); } ?>
</a>
</figure>
<div class="post_date">
<span class="day"><?php echo get_the_date('j'); ?></span>
<span class="month"><?php echo get_the_date('M'); ?></span>
</div>
<div class="post_content">
<div class="post_meta">
<h2>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h2>
<div class="metaInfo">
<span><i class="fa fa-user"></i> <?php esc_html_e('By', 'aneeq') ?> <a href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>"><?php the_author(); ?></a> </span>
<?php if (has_category()) : ?>
<span><i class="fa fa-th-list"></i>
<a href="#"><?php the_category(' , ');?></a>
</span>
<?php endif; ?>
</div>
</div>
<?php the_content(); ?>
</div>
</article>
</div>
</div>
</div><!--/.row-->
</div> <!--/.container-->
</section>
<?php get_footer(); ?>发布于 2018-09-07 07:21:28
请看下面的图片。这是您共享的文件的输出。

正如您在post_content div中和post_meta div下面看到的那样,搜索列表位于那里,而不是在row类所在的更高的位置。
在您的代码中,该块的输出与以下语句有关。
<?php the_content(); ?>因此,看起来页面的内容被动态地拉进来了。查看WordPress管理部分(当您编辑搜索页面时),看看是否有任何内容给您提供了线索。
否则,在主题目录的文件中搜索fsn-row full-width-row类。这将为您提供编辑哪个文件的线索。
https://stackoverflow.com/questions/52216823
复制相似问题