【发布时间】:2018-02-28 16:52:13
【问题描述】:
我正在尝试检查具有“checkthisone”类的<td>s 是否为空,以及它们是否隐藏了整列。我正在尝试通过 jquery 来做到这一点。该表是从 wordpress 页面循环创建的,所以我找不到使用 php 的方法。
表格HTML是这样的:
<table>
<tr>
<th>header</th>
<th id="checking-tds-header">header</th>
<th>header</th>
</tr>
<tr>
<td>info</td>
<td class="checkthisone"></td>
<td>info</td>
</tr>
<tr>
<td>info</td>
<td class="checkthisone"></td>
<td>info</td>
</tr>
</table>
显示表格的 PHP 代码在这里:https://paste.ee/p/yrQpg
我想在此代码中检查具有“temizleme”类的单元格。相关部分是:
while ( $query->have_posts() ) : $query->the_post();
?>
<tr>
<td>
<a class="mangaep-episode" href="<?php the_permalink(); ?>"><?php echo get_post_meta( get_the_ID(), 'kacinci_bolum', true ); ?>
<?php $bolum_aciklamasi = get_post_meta(get_the_ID(), 'bolum_aciklamasi', true);
if ( ! empty ( $bolum_aciklamasi ) ) { ?>
<span><?php echo $bolum_aciklamasi; ?></span>
<?php } ?>
</a>
</td>
<td><?php if(function_exists('the_views')) { the_views(); } ?></td>
<td class="down"><?php echo get_post_meta( get_the_ID(), 'cevirmen', true ); ?></td>
<td class="down"><?php echo get_post_meta( get_the_ID(), 'editor', true ); ?></td>
<td class="down temizleme"><?php echo get_post_meta( get_the_ID(), 'temizleme', true ); ?></td>
<td class="down">
<?php $indirme_linki = get_post_meta(get_the_ID(), 'indirme_linki', true);
if ( ! empty ( $indirme_linki ) ) { ?>
<a target="_blank" href="<?php echo $indirme_linki; ?>" class="mangaep-down">İNDİR</a>
<?php } ?>
</td>
</tr>
【问题讨论】:
-
这在 PHP 中应该是完全可以实现的,并且比在客户端添加功能更可取。如果你在 PHP 中包含创建表的代码,我们可以看看。
-
@FluffyKitten 我分享了一个链接,谢谢
标签: php jquery wordpress html-table