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,605 comments

Comments navigation

Older comments
Newer comments
  1. JosephabolF says:
    17. October 2025 at 18:57

    https://t.me/Official_1xbet_1xbet/1649

  2. Hung Mccure says:
    17. October 2025 at 18:57

    trustinyou.bond – Definitely sharing this with friends who might find this message helpful.

  3. Jules Lathen says:
    17. October 2025 at 18:58

    shopwithpurpose.shop – I bookmarked several things — love the mindful style here.

  4. Lakeshia Maidonado says:
    17. October 2025 at 19:01

    partnershippowerhouse.shop – I like how they showcase joint value and mutual growth.

  5. Timothy Haese says:
    17. October 2025 at 19:05

    globalunity.bond – Found several parts inspiring; feels like a community I’d like to join.

  6. Libbie Farmer says:
    17. October 2025 at 19:07

    trustinyou.bond – Clean layout, thoughtful content — not overwhelming at all.

  7. Gale Isenhour says:
    17. October 2025 at 19:07

    shopwithpurpose.shop – Great price transparency and honest product info — really appreciated.

  8. Cherilyn Pali says:
    17. October 2025 at 19:08

    smartdesigncorner.space – The layout is intuitive, images are crisp — feels professional.

  9. Sanford Bega says:
    17. October 2025 at 19:09

    inspiredmind.shop – I bookmarked several pages already — so many neat ideas.

  10. Edmond Cubbage says:
    17. October 2025 at 19:11

    partnershippowerhouse.shop – I like how they showcase joint value and mutual growth.

  11. Pamala Beresnyak says:
    17. October 2025 at 19:12

    creativegiftzone.shop – Such a fresh selection, makes gift shopping fun instead of stressful.

  12. Peggie Kuen says:
    17. October 2025 at 19:17

    globalunity.bond – Already thinking how I might collaborate or connect here.

  13. courses-ege-772 says:
    17. October 2025 at 19:17

    Слив курсов ЕГЭ 2026 https://courses-ege.ru

  14. Fredric Mimes says:
    17. October 2025 at 19:17

    trustinyou.bond – The site has a calm confidence — rare and appreciated.

  15. Neal Canul says:
    17. October 2025 at 19:24

    learnonline.bond – Already bookmarked it, will explore more later tonight.

  16. Cleo Depew says:
    17. October 2025 at 19:27

    smartdesigncorner.space – Definitely recommending this to friends needing design inspiration.

  17. JosephabolF says:
    17. October 2025 at 19:28

    https://t.me/s/Official_1xbet_1xbet/1768

  18. Millard Och says:
    17. October 2025 at 19:32

    creativegiftzone.shop – The photos are vivid and really help with decision making.

  19. Ruthie Railsback says:
    17. October 2025 at 19:44

    smartdesigncorner.space – Clean design aesthetic, love how modern and organized this looks.

  20. Josphine Beteta says:
    17. October 2025 at 19:45

    creativityuniverse.shop – Unique pieces everywhere, feels like a place for creative souls.

  21. Carlos Jean says:
    17. October 2025 at 19:51

    learnonline.bond – The previews gave me confidence this is worth investing in.

  22. Marylin Kaempfer says:
    17. October 2025 at 19:53

    creativegiftzone.shop – Found a gift for my friend in minutes, thank you!

  23. Lizbeth Strenke says:
    17. October 2025 at 19:55

    trendfinder.bond – My go-to place whenever I want to spot new trends fast.

  24. Eusebio Mester says:
    17. October 2025 at 19:56

    buildbrand.online – Interface is sleek and content feels professional and insightful.

  25. WilliamVok says:
    17. October 2025 at 19:57

    В стационаре пациент получает и физиологическую помощь, и психологическое сопровождение, что важно для долгосрочного восстановления.
    Подробнее можно узнать тут – быстрый вывод из запоя в стационаре самара

  26. Cristopher Hoisl says:
    17. October 2025 at 19:59

    creativityuniverse.shop – Wow, this site sparkles with inspiration and artistic energy everywhere.

  27. JosephabolF says:
    17. October 2025 at 20:00

    https://t.me/s/Official_1xbet_1xbet/1763

  28. Mickey Duzan says:
    17. October 2025 at 20:13

    creativityuniverse.shop – This could be a goldmine for gifting ideas and creative inspiration.

  29. mostbet_uz_uoPa says:
    17. October 2025 at 20:13

    mostbet uz скачать на компьютер http://mostbet4182.ru

  30. Clemencia Norcross says:
    17. October 2025 at 20:17

    learnonline.bond – I like that they offer clear course outlines before enrollment.

  31. Ivory Mcclimans says:
    17. October 2025 at 20:20

    inspiredideas.shop – Always enjoy seeing new posts here, they spark creativity.

  32. Isaiah Schnipper says:
    17. October 2025 at 20:20

    trendfinder.bond – The layout feels modern and everything loads really fast too.

  33. mitolyn says:
    17. October 2025 at 20:21

    **mitolyn**

    mitolyn a nature-inspired supplement crafted to elevate metabolic activity and support sustainable weight management.

  34. Astrid Lecato says:
    17. October 2025 at 20:21

    buildbrand.online – Already imagining applying some of their tips to my upcoming project.

  35. mitolyn says:
    17. October 2025 at 20:24

    **mitolyn**

    mitolyn a nature-inspired supplement crafted to elevate metabolic activity and support sustainable weight management.

  36. Anette Silversmith says:
    17. October 2025 at 20:45

    buildbrand.online – Nice visuals and good layout — makes learning branding fun.

  37. Kanesha Seigworth says:
    17. October 2025 at 20:46

    trendfinder.bond – It’s like a shortcut to what’s popular right now, amazing.

  38. fixSpero says:
    17. October 2025 at 20:51

    Откройте для себя прекрасные и загадочные места, которые находятся под охраной в нашей стране.

    Особенно понравился материал про Изучение ООПТ России: парки, заповедники, водоемы.

    Вот, можете почитать:

    https://alloopt.ru

    Что думаете о красоте природы России? Делитесь мнениями!

  39. fixSpero says:
    17. October 2025 at 20:52

    Откройте для себя прекрасные и загадочные места, которые находятся под охраной в нашей стране.

    Для тех, кто ищет информацию по теме “Изучение ООПТ России: парки, заповедники, водоемы”, есть отличная статья.

    Вот, делюсь ссылкой:

    https://alloopt.ru

    Спасибо за внимание! Надеюсь, вам было интересно.

  40. Elvis Rosh says:
    17. October 2025 at 20:55

    dailyvaluehub.shop – It’s refreshing to see so many useful items in one place.

  41. Antione Goepel says:
    17. October 2025 at 20:56

    inspiredideas.shop – Smooth navigation and fresh ideas, exactly what I needed today.

  42. JosephabolF says:
    17. October 2025 at 20:58

    https://t.me/Official_1xbet_1xbet/1847

  43. Edison Borrego says:
    17. October 2025 at 21:00

    inspiredgrowthteam.shop – The tone is uplifting, makes me feel like growth is possible.

  44. courses-ege-335 says:
    17. October 2025 at 21:05

    Слив курсов ЕГЭ география https://courses-ege.ru

  45. Kala Yorn says:
    17. October 2025 at 21:18

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

  46. Garfield Guebert says:
    17. October 2025 at 21:20

    dailyvaluehub.shop – Found great deals and useful products, reminds me of a treasure trove.

  47. yusleep says:
    17. October 2025 at 21:22

    **yusleep**

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

  48. zencortex says:
    17. October 2025 at 21:28

    **zencortex**

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

  49. JosephabolF says:
    17. October 2025 at 21:28

    https://t.me/Official_1xbet_1xbet/1775

  50. MichaelPog says:
    17. October 2025 at 21:28

    fan video

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.