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
9,038 comments

Comments navigation

Older comments
Newer comments
  1. natyajnie potolki samara_ovPr says:
    13. October 2025 at 18:07

    потолки потолки .

  2. natyajnie potolki samara_kkPr says:
    13. October 2025 at 18:07

    потолочник потолки https://natyazhnye-potolki-samara-2.ru/ .

  3. Reggie Neugebauer says:
    13. October 2025 at 18:11

    brightideaweb – Layout is intuitive, reading flow is smooth and comfortable.

  4. Jefferey Ortego says:
    13. October 2025 at 18:18

    wavefusion – Visual hierarchy is good, important stuff stands out immediately.

  5. Daina Luvene says:
    13. October 2025 at 18:28

    metarise – Visual hierarchy is great, makes scanning content simple and quick.

  6. Dalia Karpinen says:
    13. October 2025 at 18:29

    brightideaweb – Typography is crisp, spacing works well throughout the site.

  7. Lynwood Cancelliere says:
    13. October 2025 at 18:33

    sharpwave – Design is sleek and modern, very pleasing to the eyes.

  8. Doris Stenzel says:
    13. October 2025 at 18:33

    wavefusion – Really like the style here, feels fresh and creative.

  9. Kermit Guilbe says:
    13. October 2025 at 18:39

    cyberlaunch – Useful resources are easy to access, menus make sense.

  10. Shenika Nogle says:
    13. October 2025 at 18:44

    brightideaweb – The voice is friendly and encouraging, good engagement vibe.

  11. Grantcob says:
    13. October 2025 at 18:44

    Частный заем денег мфо домашние деньги альтернатива банковскому кредиту. Быстро, безопасно и без бюрократии. Получите нужную сумму наличными или на карту за считанные минуты.

  12. Chelsea Hoefel says:
    13. October 2025 at 18:48

    metarise – Pages load fast, no lag, pleasant browsing experience overall.

  13. sportsat-343 says:
    13. October 2025 at 18:48

    Все спортивные новости http://sportsat.ru в реальном времени. Итоги матчей, трансферы, рейтинги и обзоры. Следите за событиями мирового спорта и оставайтесь в курсе побед и рекордов!

  14. Monroe Boles says:
    13. October 2025 at 18:55

    sharpwave – Helpful guides here, I can apply tips right away.

  15. Kermit Gutermuth says:
    13. October 2025 at 18:57

    cyberlaunch – Visuals are sharp, layout is uncluttered and pleasing.

  16. Michal Darthard says:
    13. October 2025 at 19:06

    brightchain – Design looks modern, I like the visual elements they chose.

  17. Arlene Ferrante says:
    13. October 2025 at 19:09

    innovatewithus – Videos and articles both are engaging, love that mix.

  18. Marlin Chernick says:
    13. October 2025 at 19:09

    metarise – Very user friendly, easy to find what I need each visit.

  19. Daniel Wanger says:
    13. October 2025 at 19:14

    cyberlaunch – Navigation is smooth, didn’t struggle to find anything.

  20. Bret Kristofferson says:
    13. October 2025 at 19:18

    sharpwave – Helpful guides here, I can apply tips right away.

  21. Jenna Castagnola says:
    13. October 2025 at 19:27

    brightchain – Design looks modern, I like the visual elements they chose.

  22. sportsat-592 says:
    13. October 2025 at 19:28

    Все спортивные новости http://sportsat.ru в реальном времени. Итоги матчей, трансферы, рейтинги и обзоры. Следите за событиями мирового спорта и оставайтесь в курсе побед и рекордов!

  23. Merle Kilness says:
    13. October 2025 at 19:31

    innovatewithus – Pages load quickly, no clutter, really smooth user experience.

  24. Omer Mountcastle says:
    13. October 2025 at 19:42

    alihidaer2313 – I enjoyed browsing, the feel is straightforward and uncluttered.

  25. Frank Clarks says:
    13. October 2025 at 19:47

    cloudmark – Pages load quickly, good performance even with graphics.

  26. Eleonor Luvene says:
    13. October 2025 at 19:47

    bestchoiceonline – Deals and offers pop up nicely, gets my attention every time.

  27. Arletha Horen says:
    13. October 2025 at 19:48

    brightchain – Pages load swiftly, even images appear crisp and sharp.

  28. Loma Quandel says:
    13. October 2025 at 19:54

    innovatewithus – Videos and articles both are engaging, love that mix.

  29. Ona Spanski says:
    13. October 2025 at 20:09

    cloudmark – Color scheme is balanced; contrast helps highlight important parts.

  30. Elvera Stassen says:
    13. October 2025 at 20:11

    bestchoiceonline – Overall experience positive, likely to recommend to friends.

  31. Millicent Schlepphorst says:
    13. October 2025 at 20:16

    nextbrand – Looks sleek, very modern layout and clean with good contrast.

  32. Onita Latronica says:
    13. October 2025 at 20:33

    cloudmark – Visuals are crisp and layout looks modern and polished.

  33. Sung Tomich says:
    13. October 2025 at 20:36

    bestchoiceonline – Checkout felt simple and secure, confidence inspiring.

  34. Samella Legaspi says:
    13. October 2025 at 20:40

    nextbrand – Lots of useful info, clearly organized and easy to parse.

  35. Alona Leverette says:
    13. October 2025 at 20:42

    digitalstorm – Colors and contrast are well balanced, pleasant to look at.

  36. George Sexton says:
    13. October 2025 at 20:46

    everythingyouneedtoknow – Navigation is well-thought, found deep info without confusion.

  37. Jeffery Michelsen says:
    13. October 2025 at 20:47

    discoveramazingthingsonline – Typography is readable, images attract attention without overwhelming.

  38. Brianne Klien says:
    13. October 2025 at 20:53

    explorecreativeideasdaily – Color palette is refreshing, helps keep me motivated while browsing.

  39. Sanora Maurey says:
    13. October 2025 at 21:05

    nextbrand – Lots of useful info, clearly organized and easy to parse.

  40. Elisha Fullford says:
    13. October 2025 at 21:06

    digitalstorm – The voice feels authentic, technical without being overwhelming.

  41. Michael Eberwein says:
    13. October 2025 at 21:08

    everythingyouneedtoknow – Pages load fast, no waiting even on image-heavy content.

  42. Doug Mendenhall says:
    13. October 2025 at 21:09

    discoveramazingthingsonline – Typography is readable, images attract attention without overwhelming.

  43. Jeneva Mctague says:
    13. October 2025 at 21:16

    ultrawave – Color choices work well, read-ability is excellent throughout.

  44. Paige Wilhoite says:
    13. October 2025 at 21:17

    explorecreativeideasdaily – Visuals are engaging, complement the creative topics perfectly.

  45. Olen Ramey says:
    13. October 2025 at 21:23

    globalreach – Very intuitive to explore, links make sense and are easy to find.

  46. Jess Ghazal says:
    13. October 2025 at 21:30

    digitalstorm – The voice feels authentic, technical without being overwhelming.

  47. Dominga Kridel says:
    13. October 2025 at 21:31

    everythingyouneedtoknow – Tone is friendly but authoritative, good balance for trust.

  48. Melvina Metherell says:
    13. October 2025 at 21:32

    discoveramazingthingsonline – Really love the name, sounds exciting and adventurous.

  49. Vicente Halmes says:
    13. October 2025 at 21:37

    yourbrandzone – Feels professional yet friendly, not overly formal.

  50. Marlin Desantos says:
    13. October 2025 at 21:38

    pixelplanet – Colors and typography complement each other nicely, very readable.

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.