I-WordPress: Enza ngendlela oyifisayo i-CSS uma iPosi Ishicilelwe Namuhla

logopress logo

Kade ngifuna ukufaka imidwebo emincane yekhalenda kokuthunyelwe kwami ​​isikhashana manje. Ngabhala amakilasi amabili wedethi yedis futhi ngasetha isithombe sangemuva ngokuhlukile ngokuya ngokuthi ngabe okuthunyelwe kubhalwe noma cha namhlanje. Sibonga u UMichael H kwizithangami Zokusekela zeWordPress, Ekugcineni ngathola isitatimende sami silungile! Nakhu engikwenzile. Nginesithombe sangemuva esisethelwe usuku lwesigaba se-div:


Kwi-div yanamuhla, ngisetha isithombe sangemuva esihlukile esisetshenziswe kusigaba se-div esibizwa nge- the_date_today:


Manje njengoba senginalawo masethi, ngidinga ukubhala ikhodi ethile engeza i- “_today” uma okuthunyelwe bekubhalwe namuhla:

post_date_gmt); if($post_date==gmdate('Ymd')) { echo '_today'; } ?>">

Nakhu ukuthi kusebenza kanjani:

  1. Ngisetha okuguquguqukayo okubizwa nge- $ post_date elilingana nosuku lokuthunyelwe ifomethwe njenge-Ymd.
  2. Ngibhala isitatimende se- if ukuze uma lokho kuguquguquka kulingana nosuku lwanamuhla (olufomethwe njenge-Ymd), ngifaka i- "_today"

Voila! Manje senginomfanekiso wekhalenda obonisa ukuthi okuthunyelwe kubhalwe noma cha! Ngidinga nje ukuzivumelanisa nendawo yesikhathi futhi ngizoyenza!

5 Amazwana

  1. 1

    Sawubona Doug. Lokho kushelele ngempela!

    Inothi eliseceleni, ngiphakamisa ukuthi uhambise ibhokisi lakho lokubhalisela 'ukubhalisela' ngaphezu kwenkinobho yokufaka amazwana ... kimi lokho okusebenziseka kalula.

    Umsebenzi omuhle kuzithombe zakho ezintsha zekhalenda ne-CSS.

    • 2

      Ngiyabonga Sean.

      Ukuma kwebhokisi lokuhlola kungenhloso. Ukuyibeka ngaphandle kweminye imikhakha kuzodala ukwahlukana phakathi kwayo nezinye izinkambu ezivalwe ngci. Ngokuyibeka eduze kwenkinobho, ifaka ukukhetha eduze kwesenzo, lokhu empeleni kungadala abantu abaningi ukuthi bakuphuthe njengoba beqedela imicabango yabo emazwaneni bese behambisa.

      Into eyodwa elahlekile ukuma kahle kwamathebhu, noma kunjalo. Ngizokulungisa lokho.

  2. 3

    Ngicabanga ukuthi kunesiphazamisi kwikhodi yakho manje njengoba sekuwusuku olusha. Isithonjana sekhalenda sisasho nanamuhla kepha empeleni kusasa manje 🙂

  3. 5

    Kulungile, angibonanga ukuthi yilokhu owawukuqonde ngokulungisa i-GMT.

    Nginesiqiniseko sokuthi uphezu kwayo mr code monkey 🙂 kepha mhlawumbe ungenza uhlobo oluthile lwesitatimende 'uma' ubheka isikhathi sakho se-server?

    uma usuku / isikhathi seseva kungu-X uma kuqhathaniswa nesikhathi sokuthumela / isikhathi sombukiso X wesithombe noma okuthile kulokho.

UCABANGANI?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda ukuthi idatha yakho yokuphawula isetshenziswa kanjani.