WordPress: Saincheap CSS má tá an Post Foilsithe Inniu

logopress wordpress

Bhí mé ag iarraidh na grafaicí beaga féilire a chur le mo phoist le tamall anois. Scríobh mé dhá rang don dáta div agus leag mé an íomhá cúlra ar bhealach difriúil bunaithe ar cibé ar scríobhadh an post inniu nó nach raibh. A bhuíochas sin do Michael H sna Fóraim Tacaíochta WordPress, Fuair ​​mé mo ráiteas i gceart faoi dheireadh! Seo an méid a rinne mé. Tá íomhá cúlra socraithe agam do dháta an ranga div:


Maidir le div an lae inniu, leag mé íomhá cúlra difriúil a cuireadh i bhfeidhm ar rang div darb ainm the_date_today:


Anois go bhfuil na tacair sin socraithe agam, ní mór dom cód éigin a scríobh a chuireann an “_today” leis má scríobhadh an post inniu:

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

Seo an chaoi a n-oibríonn sé seo:

  1. Shocraigh mé athróg ar a dtugtar $ post_date cothrom le dáta an phoist formáidithe mar Ymd.
  2. Scríobhaim ráiteas más amhlaidh más ionann an athróg sin agus dáta an lae inniu (formáidithe mar Ymd freisin), cuirim “_today”

Voila! Anois tá grafach féilire agam a thaispeánann cibé ar scríobhadh an post inniu nó nach raibh! Níl uaim ach dul i dtaithí ar an gcrios ama agus beidh orm é a dhéanamh!

5 Comments

  1. 1

    Hey Doug. That’s really slick!

    Side note, I suggest you move your ‘subscribe to’ check box above the add comment button… to me that’s a little more user friendly.

    Great job on your new calendar graphics and CSS.

    • 2

      Thanks Sean.

      The positioning of the check box is on purpose. Putting it outside the other fields would create separation between it and the other tightly spaced fields. By placing it near the button, it’s putting a selection near an action, this actually might cause more people to miss it as they complete their thoughts in a comment and move to submit.

      One thing that is missing is proper tab stops, though. I am going to correct that.

  2. 3
  3. 5

    Ok, I didn’t realize that’s what you were meaning about adjusting for GMT.

    I’m sure you’re on top of it mr code monkey 🙂 but maybe you could do some sort of ‘if’ statement looking at your server time?

    if server date/time is X compared to post date/time show X image or something to that effect.

Cad é do bharúil?

Úsáideann an suíomh seo Akismet chun spam a laghdú. Foghlaim conas a dhéantar próiseáil ar do chuid tráchta.