欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

如何才能只顯示有值的自定義字段,而隱藏沒有值的字段及其對應的CSS?

錢衛國2年前10瀏覽0評論

更新:當我停用光速現金插件時,問題得到了解決!但是我怎樣才能在不關閉插件的情況下解決這個問題呢???

我有3個自定義字段免費軟件,試用和apk每個都有它的CSS,現在我只希望自定義字段有值顯示,沒有值不顯示完全(與他們的CSS)。

https://softcroco.com/download-shareit-apk/

問題截圖:

在上面的URL中,免費軟件和apk CFs有價值,試用版沒有價值,但當我打開或刷新頁面時,它的CSS仍然出現,然后消失!

我想讓沒有值的自定義字段完全不出現!

我的代碼:

<span class="freeware"><?php echo get_post_meta($post->ID, 'freeware', true); ?></span>
                                <span class="apk"><?php echo get_post_meta($post->ID, 'apk', true); ?></span> 
                                <span class="trial"><?php echo get_post_meta($post->ID, 'trial', true); ?></span>

<script> const author = document.querySelector('.author'); const freeware = document.querySelector('.freeware'); const apk = document.querySelector('.apk'); const trial = document.querySelector('.trial'); if (author.textContent.trim() === '') {author.remove(); } if (freeware.textContent.trim() === '') { freeware.remove(); } if (apk.textContent.trim() === '') { apk.remove(); } if (trial.textContent.trim() === '') { trial.remove(); } </script>

.freeware { align-items: center; border: 1px solid rgba(38,153,251,.25); border-radius: 24px; color: #2699fb; display: inline-block; font-size: 12px; font-weight: 600; justify-content: center; padding: 0px 10px; border: 1px solid rgba(83,204,39,.25); color: #fff!important; background: #018660; margin-left: -5px;}.apk { align-items: center; border: 1px solid rgba(38,153,251,.25); border-radius: 24px; color: #ff003b; display: inline-block; font-size: 12px; font-weight: 600; justify-content: center; padding: 0px 10px; border: 1px solid #ff003b; color: #fff!important; background: #ff003b; margin-left: -5px; }.trial { align-items: center; border: 1px solid rgba(38,153,251,.25); border-radius: 24px; color: #ff003b; display: inline-block; font-size: 12px; font-weight: 600; justify-content: center; padding: 0px 10px; border: 1px solid #ff003b; color: #fff!important; background: #ff003b; margin-left: -5px; } .freeware, .apk, .trial { font-family: 'Roboto Slab'; font-size: 13px;} .infosoftware { display: flex; align-items: center; margin-top: -5px; }

很多CSS的改動!

如果元素確實是空的,沒有空格,您可以這樣做:

.freeware:empty, 
.apk:empty, 
.trial:empty {
  display: none;
}