wordpress如何判斷文章沒有內容時自動加上一段文字

admin wordpress評論703字數(shù) 165閱讀模式
摘要

wordpress 如何判斷文章沒有內容時自動加上一段文字,比如XX文章內容為空,自動補上文字,對不起,暫無內容。有內容則不顯示。如何改?

下面操作方法
如果不需要特殊定義用the_content()就好,如果需要完成你的要求,代碼如下:

  1. $contentinfo = get_the_content();  
  2. if( $contentinfo ){  
  3.     echo $contentinfo;      
  4. }else{  
  5.     echo "對不起,暫無內容";  
  6. }  
文章源自網(wǎng)吧系統(tǒng)維護-http://m.hvig.cn/7806.html文章源自網(wǎng)吧系統(tǒng)維護-http://m.hvig.cn/7806.html
版權聲明:文章圖片資源來源于網(wǎng)絡,如有侵權,請留言刪除!!!
廣告也精彩
admin
  • 本文由 發(fā)表于 2021年9月29日 17:07:46
  • 轉載請務必保留本文鏈接:http://m.hvig.cn/7806.html
匿名

發(fā)表評論

匿名網(wǎng)友 填寫信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: