php - 为什么我的 div 在 WP 模板中嵌套?
问题描述
我为 wordpress 网站创建了一个模板,我的 div 正在嵌套。该代码在我的codepen中运行,但是当我使用自定义帖子类型运行它时,它会嵌套它们。我读过它有时是因为打开的 div,这是有道理的,但我没有看到任何东西。有没有人经历过这个或看到任何问题?
<?php
get_header();
//the_content();
$args = array(
'post_type' => 'patterns'
);
$patterns = new WP_Query( $args );
if ( $patterns->have_posts() ) : ?>
<?php while( $patterns->have_posts() ) : $patterns->the_post() ?>
<div class="image_hover_appear <?php $categories = get_the_category( $patterns->ID, 'category' );
foreach( $categories as $category ) {
echo $category->slug . ' ';
} ?>">
<div class="appear_container">
<img src="https://via.placeholder.com/300" alt="<?php the_title(); ?>">
<div class="appear_content">
<div class="appear_title">
<?php the_title(); ?>
</div>
<div class="appear_desc">
<!--This is the description-->
</div>
</div>
<a href="https://via.placeholder.com/300" class="appear_link" data-fancybox ></a>
<div class="appear_overlay"></div>
<div class="appear_border-top"></div>
<div class="appear_border-bottom"></div>
</div>
</div>
<?php endwhile ?>
<?php endif ?>
<?php get_footer(); ?>
解决方案
问题在于 astra 主题和我的孩子主题。我将自定义模板的代码添加到 archive.php 文件中,最后改变了布局。问题并不像看起来那样。
推荐阅读
- reporting-services - Power BI 报表服务器自定义身份验证:在不同计算机中托管网页和 PBIRS 的 IIS
- nginx - Nginx 反向代理基本认证 Base64 Url 编码
- acumatica - 处理屏幕的 Acumatica 分页实现不返回所有适用值
- html - 如何使用 HTML tag on rmarkdown?
- kubernetes - Kubernetes pod 卡在状态 = 节点进入状态后终止 = NotReady?
- node.js - 使用 Slack 命令打开模态
- reactjs - 我应该在或它的周围元素中使用 onCLick={} 函数
- forms - Xamarin 表单 - 找不到 -lrealm-wrapper 的库
- java - 从文本文件中读取/打印不同的行数
- java - Android 不会正确本地化字符串,除非它们在设备上是“首选”。有解决方法吗?