WordPress: Customize CSS yog tus Tshaj Tawm Luam tawm Niaj hnub no

wordpress logo

Kuv tau xav tau ntxiv rau me ntsis daim duab duab rau kuv cov posts ib pliag tam sim no. Kuv tau sau ob chav kawm rau hnub div thiab teeb tsa cov duab keeb kwm yav dhau los sib txawv los ntawm seb puas los yog tsis tshaj tawm uas tau sau hnub no. Tsaug rau Michael H hauv WordPress Support Forums, Kuv thaum kawg tau txais kuv cov lus qhia tseeb! Ntawm no yog qhov kuv tau ua. Kuv muaj keeb kwm yav dhau los tso rau div chav kawm hnub:


Txog div niaj hnub no, Kuv teeb duab tom qab sib txawv thov rau chav div div npe hu ua_date_today:


Tam sim no kuv tau txais cov teeb ntawd, Kuv xav sau ib co cai uas ntxiv rau "_today" yog tias tus ncej tau sau hnub no:

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

Ntawm no yog li cas no ua haujlwm:

  1. Kuv muab qhov sib txawv hu ua $ post_date sib npaug rau hnub tim ntawm daim ntawv muaj teeb meem ua Ymd.
  2. Kuv sau ib tsab ntawv yog cov nqe lus uas txhais tau hais tias yog qhov sib txawv ntawm qhov sib npaug hnub no (muaj tus qauv ntawm Ymd thiab), Kuv ntxiv “_today”

Voila! Tam sim no kuv tau muaj daim ntawv qhia hnub daim duab uas qhia txog seb puas los yog tsis yog tshaj tawm tau sau hnub no! Kuv tsuas yog xav tau kho rau timezone thiab Kuv mam li ua nws!

5 Comments

  1. 1

    Hav Doug. Ntawd yog slick tiag tiag!

    Sab ntawv, Kuv xav kom koj tshem koj 'sau npe yuav' khij lub npov saum toj sau khawm ntxiv… rau kuv uas yog tus neeg siv tau me ntsis.

    Cov haujlwm zoo ntawm koj daim calendar tshiab thiab CSS.

    • 2

      Sean tsaug.

      Txoj haujlwm muab kos rau ntawm lub thawv yog nyob ntawm lub hom phiaj. Muab nws tso rau sab nraud ntawm lwm qhov yuav tsim kev sib cais nruab nrab ntawm nws thiab lwm daim teb nruj me ntsis. Los ntawm tso nws nyob ze rau ntawm lub pob, nws tau tso cov kev xaiv nyob ze ntawm qhov kev nqis tes ua, qhov no tiag yuav ua rau ntau tus neeg nco nws thaum lawv ua tiav lawv cov kev xav hauv kev tawm tswv yim thiab tsiv mus rau xa.

      Ib qho uas tau ploj lawm yog tab txoj cai nres, tab sis. Kuv yuav los kho qhov ntawd.

  2. 3

    Zoo Kuv xav tias muaj kab laum nyob hauv koj cov cai tam sim no tias nws yog hnub tshiab. Hauv daim ntawv qhia hnub icon tseem hais hnub no tab sis nws yog tiag tiag tag kis tam sim no

  3. 5

    Ok, kuv tsis tau paub tias yog dab tsi koj tau txhais hais txog kev hloov kho rau GMT.

    Kuv paub tseeb tias koj nyob saum nws mr code liab 🙂 tab sis tej zaum koj tuaj yeem ua qee qhov 'yog tias' cov lus hais saib koj lub sijhawm server?

    yog hnub vas xaum / sijhawm yog X piv rau post hnub / sijhawm qhia X duab lossis ib yam dab tsi rau yam ntawd.

Yuav ua li cas koj xav hais tias?

Qhov Web site no siv Akismet los txo cov kev pabcuam. Kawm li cas koj cov ntaub ntawv tawm tswv yim tiav.