Home › Widgets › WordPress

Install guide

How to add a prayer times widget to WordPress

Add a Custom HTML block wherever you want the widget, paste one line of code from Niyat's widget builder, and update the page. It takes about a minute and needs no plugin.

Steps

  1. Open the page or post you want the widget on, in the WordPress block editor.
  2. Click the + (Add block) icon and search for Custom HTML. Add it where you want the widget to appear.
  3. Paste the embed code into the Custom HTML block. You can copy your own version, with your city and calculation method already filled in, from the widget builder.
  4. Click Preview in the top toolbar to check the widget renders before it goes live.
  5. Click Update (existing page) or Publish (new page).

Good to know. WordPress strips script tags out of a normal Paragraph block, so the Custom HTML block is required — pasting into any other block type will not work. For a site-wide placement, such as every page's footer, a header/footer plugin like WPCode can insert the code once instead of per page.

This is a generic starting point. Open the widget builder to set your own coordinates, timezone, and calculation method, and to build the Hijri date or Ramadan countdown widget instead.

FAQ

Frequently asked questions

Do I need a plugin to add this widget?

No. The Custom HTML block ships with WordPress by default. A plugin is only useful if you want the widget to appear automatically on every page without adding the block each time.

Will my WordPress theme break the widget, or the widget break my theme?

No. The widget renders inside an isolated shadow DOM container, so your theme's CSS cannot change its appearance and the widget's styles cannot leak out into your theme.

Does this work with WordPress.com as well as self-hosted WordPress.org?

Yes for self-hosted WordPress.org sites and for WordPress.com plans that allow the Custom HTML block (Premium plan and above). WordPress.com's free and Personal plans restrict custom HTML and JavaScript.

Get adhan reminders on your phone

The Niyat app brings calculated prayer times, adhan notifications, a qibla finder, and the full cited dua library with you.

Keep exploring