# A WordPress plugin that shows today's panchang

> A WordPress plugin: paste your key under Settings, add `[astronode_panchang]` to any post, page or widget area, and the site shows today's panchang for the place you choose - cached until that place's midnight, so a busy site makes two API calls a day per location.

Source: https://astronode.dev/templates/wordpress-panchang-plugin · Updated: 2026-12-05

## What it does

- A shortcode `[astronode_panchang lat lng tz label]` and theme functions `astronode_panchang_html()` and `astronode_the_panchang()`; `tz` takes an IANA zone or a fixed offset, and defaults to the site's zone.
- Calls both endpoints with `wp_remote_post` and caches the result in a transient until local midnight at that place; a failed call is remembered for five minutes so an outage does not hammer the API.
- The key is stored through the Settings API with autoload off, never printed back (only its last four characters), and can be tested or removed from the settings page.
- Administrators see the API's error message, code and request id; visitors see a neutral line.
- Every output is escaped, every form action checks a nonce and `manage_options`, and `uninstall.php` removes the option and all cached transients, including on multisite.

## Endpoints and plan

*API calls the template makes*

| Endpoint | Used for | Plan |
| --- | --- | --- |
| `POST /v1/panchang` | Tithi, nakshatra, yoga, karana, sunrise, sunset | Free |
| `POST /v1/muhurta/inauspicious` | Rahu Kaal | Hobby |

It needs a Hobby key or above: at least one endpoint it calls is not on the Free plan. See [pricing](https://astronode.dev/pricing).

## Where things live

| File | What it holds |
| --- | --- |
| `astronode-panchang.php` | Plugin header, the shortcode and the theme functions |
| `includes/class-astronode-panchang-client.php` | Request bodies, the two API calls, transient caching |
| `includes/class-astronode-panchang-renderer.php` | The escaped HTML card |
| `includes/class-astronode-panchang-settings.php` | Settings page, Test connection, Clear cache |
| `uninstall.php` | Clean removal |
| `readme.txt` | WordPress.org readme |

## Keys and deployment

- The API key is read from the server's environment and sent as `Authorization: Bearer <key>`; it never reaches a browser or an app bundle.
- `node check.mjs` checks the PHP statically - every string in the text domain, every output escaped, nonces on form handlers, the plugin header - and CI runs `php -l` on every file.
- Install like any plugin: copy the folder to `wp-content/plugins/astronode-panchang/` or upload it as a zip from Plugins > Add New.
- `ASTRONODE_API_URL` in `wp-config.php` (or the `astronode_panchang_api_url` filter) points it at another API host.
- Before submitting to WordPress.org, add a licence header and confirm the `Tested up to` and contributor fields in `readme.txt`.

## Questions

**Which plan does the WordPress panchang plugin need?**

Hobby or above, for Rahu Kaal. The panchang itself is on Free; the README shows how to drop the Rahu Kaal call to run on a Free key.

**Will a busy WordPress site use up the API quota?**

No. Each place's panchang is cached until that place's midnight, so the cost is two calls a day per location shown, however many visitors there are.

**Can it show the panchang for the visitor's own city?**

It shows the place in the shortcode. For per-visitor places, call `astronode_panchang_html()` with coordinates from your own lookup; each place is cached separately.

## Related pages

- [Integration: WordPress](https://astronode.dev/integrations/wordpress)
- [Use case: panchang widget](https://astronode.dev/use-cases/panchang-widget)
- [Self-hosted panchang widget](https://astronode.dev/templates/panchang-widget)
- [All templates](https://astronode.dev/templates)
