wordpress如何判斷文章沒有內(nèi)容時(shí)自動(dòng)加上一段文字

admin wordpress評論664字?jǐn)?shù) 165閱讀模式
摘要

wordpress 如何判斷文章沒有內(nèi)容時(shí)自動(dòng)加上一段文字,比如XX文章內(nèi)容為空,自動(dòng)補(bǔ)上文字,對不起,暫無內(nèi)容。有內(nèi)容則不顯示。如何改?

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

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