this post was submitted on 15 Dec 2023
14 points (85.0% liked)

Asklemmy

43858 readers
1700 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~

founded 5 years ago
MODERATORS
 

Ho everybody,

I would create a Little Digital Clock that shows exact time of a city (for example Amsterdam) and I would insert the time of sunset for a WordPress site, but I'm a noob in HTML. Can you guide me please? Thanks in advance

you are viewing a single comment's thread
view the rest of the comments
[โ€“] foggy@lemmy.world 14 points 11 months ago* (last edited 11 months ago) (1 children)

Sorry everyone's being so unhelpful.

To get the time, you'll use a script tag (because that will feel familiar if you're a noob, but ideally, you'll have separate JavaScript files that are just referenced rather than having it embedded in your html ๐Ÿค“). This will mean learning basic vanilla JavaScript. This is a great opportunity to expand a little bit of knowledge.

Ok I'm trying to insert html code snippets and it's parsing the html lmao. Idk if I can show you... Hmmm. Let's see. I'll update this in a sec.

All the info you really need to accomplish this is on this page.

Just go into a "try it yourself" example, it's all html, and a script tag with the JavaScript example of what you are... Trying yourself :)

Pay attention to the html elements ID tags and the script tags "getElementById" calls.

Now if you're using Divi or Elementor or some other page builder on WordPress, their editor might be wonky with adding script tags. That's when you'll need to level up a tiny bit further. Basically, you'll (probably download a plugin that allows you to explore the filesystem, but these are generally unsafe!) download filezilla, find out the WordPress DB user/pass, connect via SFTP in filezilla. Then you'll navigate to your theme, find a JavaScript folder and add a file with this script innards in it. Then, you reference that filepath in your HTML instead of doing it in a script. (And we thought page builders were making our lives easy!)

It might sound like a lot. Ask ChatGPT or Bard for help, they'll guide you through easy mode or hard mode here. I'm happy to elucidate, too :)

[โ€“] LukeSky@lemmy.ml 4 points 11 months ago

Wow! I'll try everything you've said! Thanks you very much!