ph91.de
  • Home
  • About me
  • Categories
    • Software Development
    • New Zealand
    • Music
    • Tech & IT
    • Sports
    • Dublin
    • Junk
  • Contact
  • Disclaimer
ph91.de
ph91.de
  • Home
  • About me
  • Categories
    • Software Development
    • New Zealand
    • Music
    • Tech & IT
    • Sports
    • Dublin
    • Junk
  • Contact
  • Disclaimer
  • Software Development

wpDataTables Hack: Default to current year

  • 23. January 2021
  • Philipp

For speed-kini.de we have two types of tables:

  1. Tables which show the current rankings overall, women, juniors, foil..
  2. Tables which show rankings of previous years (archive) for overall, women, juniors, foil…

The initial approach was having two different wpDataTables: one for the current year and one with the year as variable. This duplication should ring all your software engineer alarm bells! 

Another possibility would have been to use the archive tables for the current rankings by just setting the variable to 2021, 2022 etc… this would mean work every year to edit the wordpress pages and manually increase the variable to the current year. So this is a bit nicer but still means regular maintenance work.

After some thought, I ended up with a neat approach how to use one table for both: current and archive.

For the current year you just leave the variable empty and for archive you specify the variable to your desired year. 
The mechanism to default to the current year in case no year is specified consists of two parts:

#1 Setting the default value of %VAR1% to a very high number (> 5000 should be enough 😉 )

#2 Small SQL modifications to the places which use %VAR1%

[...]

WHERE
YEAR(date) = LEAST(year(curdate()), %VAR1%)

[...]

Related Topics
  • speed-kini
  • wordpress
  • wpDataTables
Philipp

Previous Article
action adventure beach clouds
  • Software Development

Creating “Windwarner”

  • 2. January 2021
  • Philipp
View Post
12,817 comments

Comments navigation

Older comments
Newer comments
  1. yu sleep says:
    17. October 2025 at 21:30

    **yu sleep**

    yusleep is a gentle, nano-enhanced nightly blend designed to help you drift off quickly, stay asleep longer, and wake feeling clear.

  2. zencortex says:
    17. October 2025 at 21:34

    **zencortex**

    zencortex contains only the natural ingredients that are effective in supporting incredible hearing naturally.

  3. Sima Stribble says:
    17. October 2025 at 21:36

    inspiredideas.shop – Their products look inspiring and the site feels very polished.

  4. Shaina Baragan says:
    17. October 2025 at 21:37

    inspiredgrowthteam.shop – Clean design and motivating content — exactly what I need right now.

  5. FrancisDew says:
    17. October 2025 at 21:37

    Снятие интоксикации, восстановление организма и наблюдение — так проходит вывод из запоя в стационаре «Частный Медик 24».
    Разобраться лучше – vyvod-iz-zapoya-v-stacionare23.ru/

  6. Marty Marner says:
    17. October 2025 at 21:37

    startsomethingnew.shop – Found a few things I’d like to explore further later.

  7. Jenelle Griffes says:
    17. October 2025 at 21:38

    buildlastingtrust.bond – I can sense authenticity, which is rare these days.

  8. Marica Krewer says:
    17. October 2025 at 21:40

    brightfuturegroup.bond – I found their mission clearly stated, very motivating and transparent.

  9. RandallFew says:
    17. October 2025 at 21:41

    https://clocks-top.com/

  10. Emmett Franceschini says:
    17. October 2025 at 21:42

    findnewtrend.shop – Found something I might actually buy — good selection.

  11. neymar says:
    17. October 2025 at 21:43

    Где сейчас играет Неймар и под каким номером? Нужны быстрые ответы для мобил фанатов mobil futbol. Интересует «неймар рост вес возраст» по годам — удобнее видеть в одной инфографике. Нужны «неймар обои 4к» без водяных знаков и с правильным соотношением сторон. неймар обои 4к. Где играет Неймар 2024/2025 и как выглядит его роль? Интересно для анализа комбинаций.
    Неймар Бразилия: обои в национальной форме, стадионный свет и динамика движения. Неймар религия: редкая тема, важно корректно и без спекуляций — есть проверенные источники? Аманда Кимберли и Неймар — встречал упоминания, нужна верификация фактов. Где играет Неймар 2025 — обновляю карточки игрока в своём блоге.
    Неймар барса обои 4К — важно проверить соотношение сторон под ультраширокие мониторы. Неймар лучшие фото — интересны кадры из туннеля и разминки, редко попадаются.

  12. Evelyne Leblanc says:
    17. October 2025 at 21:45

    dailyvaluehub.shop – Navigation feels intuitive and the filters work really smoothly.

  13. mostbet_uz_stPa says:
    17. October 2025 at 21:52

    mostbet online скачать https://www.mostbet4182.ru

  14. Aubrey Sheldon says:
    17. October 2025 at 21:54

    startsomethingnew.shop – Shares the kind of inspiration I enjoy in lifestyle and creativity.

  15. courses-ege-158 says:
    17. October 2025 at 21:55

    Курсы по информатике ЕГЭ https://courses-ege.ru

  16. Haley Mcclean says:
    17. October 2025 at 21:56

    buildlastingtrust.bond – Really impressed by the focus on credibility and long-term relationships.

  17. JosephabolF says:
    17. October 2025 at 21:57

    https://t.me/Official_1xbet_1xbet/1746

  18. China Bugni says:
    17. October 2025 at 22:01

    trustandunity.shop – The tone is respectful and uplifting, very nice experience browsing.

  19. mostbet_uz_rdEr says:
    17. October 2025 at 22:01

    mostbet uz ro‘yxatdan qanday o‘tish mostbet uz ro‘yxatdan qanday o‘tish

  20. Yolanda Habermehl says:
    17. October 2025 at 22:01

    findnewtrend.shop – Loved how clean and straightforward the product pages are.

  21. Jude Downton says:
    17. October 2025 at 22:03

    smartstylehub.shop – Great range of items, something stylish for every taste.

  22. Seymour Landauer says:
    17. October 2025 at 22:08

    brightfuturegroup.bond – I found their mission clearly stated, very motivating and transparent.

  23. courses-ege-660 says:
    17. October 2025 at 22:08

    Полный курс ЕГЭ https://courses-ege.ru

  24. Gordon Garced says:
    17. October 2025 at 22:13

    startsomethingnew.shop – The site’s vibe motivates me to try something different.

  25. Mindi Dupler says:
    17. October 2025 at 22:16

    buildlastingtrust.bond – Design is clean, message is clear — feels very sincere.

  26. Eldridge Schiffert says:
    17. October 2025 at 22:17

    globalpartnershipteam.bond – Love the global vision here, feels inclusive and ambitious.

  27. Arlen Heidt says:
    17. October 2025 at 22:19

    visionaryleadersclub.bond – Clean site design, feels professional and motivational.

  28. Windy Corbley says:
    17. October 2025 at 22:20

    trustandunity.shop – Images are quality, site feels polished — positive first impression.

  29. Darcel Cleath says:
    17. October 2025 at 22:20

    findnewtrend.shop – Love the vibe here—very up-to-date and stylish items.

  30. Gus Nishi says:
    17. October 2025 at 22:23

    smartstylehub.shop – Looks like a good place for both trend seekers and minimalists.

  31. JosephabolF says:
    17. October 2025 at 22:26

    https://t.me/Official_1xbet_1xbet/1754

  32. Earl Lazenson says:
    17. October 2025 at 22:26

    modernchoice.store – I like how clean the design is, space makes browsing relaxing.

  33. courses-ege-517 says:
    17. October 2025 at 22:27

    Сливы курсов по подготовке к ЕГЭ 2026 https://courses-ege.ru

  34. Robbie Swimm says:
    17. October 2025 at 22:27

    trustedbusinesslink.shop – I like how professional the graphics and presentation are here.

  35. Leone Horen says:
    17. October 2025 at 22:32

    buildlastingties.bond – I found the resources relevant and genuinely helpful.

  36. Mercy Kveen says:
    17. October 2025 at 22:36

    brightfuturegroup.bond – Already sharing with friends — this has serious potential.

  37. MichaelPog says:
    17. October 2025 at 22:36

    online connect

  38. Bryan Piatt says:
    17. October 2025 at 22:38

    globalpartnershipteam.bond – Visuals and copy work well together — no confusing parts.

  39. Maurice Skanes says:
    17. October 2025 at 22:38

    trustandunity.shop – I’ll revisit this one for sure; it’s growing on me.

  40. Terrance Luechtefeld says:
    17. October 2025 at 22:43

    smartstylehub.shop – Definitely recommending this to friends who love fashion innovation.

  41. Earnest Vidalez says:
    17. October 2025 at 22:46

    modernchoice.store – Definitely bookmarking this, feels like a go-to for modern finds.

  42. Fernando Degiacomo says:
    17. October 2025 at 22:50

    trustedbusinesslink.shop – Nice user experience, smooth navigation between pages.

  43. Wallace Kliem says:
    17. October 2025 at 22:53

    visionaryleadersclub.bond – Clean site design, feels professional and motivational.

  44. Morris Matsko says:
    17. October 2025 at 22:54

    buildlastingties.bond – Feels like a place where commitment and values come first.

  45. JosephabolF says:
    17. October 2025 at 22:55

    https://t.me/Official_1xbet_1xbet/1658

  46. Harold Sayre says:
    17. October 2025 at 23:00

    globalpartnershipteam.bond – The site seems well structured, easy to understand partnerships.

  47. Demetrius Wiechman says:
    17. October 2025 at 23:15

    trustedbusinesslink.shop – Their about section is clear; good to see transparency.

  48. Mckenzie Hoberg says:
    17. October 2025 at 23:17

    buildlastingties.bond – Clean interface, easy to navigate and understand.

  49. DanielErept says:
    17. October 2025 at 23:28

    Если вы ищете надежную клинику для вывода из запоя, обратитесь в «Детокс» в Краснодаре. Услуга вызова нарколога на дом доступна круглосуточно. Врачи приедут к вам в течение 1–2 часов и окажут необходимую помощь.
    Ознакомиться с деталями – вызвать нарколога на дом краснодар

  50. Mauricio Waller says:
    17. October 2025 at 23:28

    visionaryleadersclub.bond – Clean site design, feels professional and motivational.

Comments navigation

Older comments
Newer comments

Leave a Reply

Your email address will not be published. Required fields are marked *

ph91.de
Blog by Philipp Schreitmüller

Input your search keywords and press Enter.