| 开发者 | indesignmedia |
|---|---|
| 更新时间 | 2026年8月6日 00:17 |
| PHP版本: | 8.2 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
indesign-nepali-post-date folder to /wp-content/plugins/, or install it from the Plugins screen.[indnpd_post_date], [indnpd_today_date], [indnpd_number number="123"], or [indnpd_post_calendar].Gregorian (AD) to Bikram Sambat (BS), the official calendar of Nepal. AD 2024 lands around BS 2081.
BS 2000 to BS 2101 (AD 1943-04-14 to AD 2044). Dates outside that range come back unchanged.
Inside The Loop:
<?php echo indesign_nepali_post_date_get( get_the_date('Y-m-d H:i:s') ); ?>
Or if you want to pass your own format and language:
<?php echo indnpd_get_date( get_the_date('Y-m-d H:i:s'), 'd M Y, l', 'nepali' ); ?>
The older id_nepali_post_date_get() name still works if you already have it in your theme.
Yes. Open Nepali Post Date in the admin sidebar and switch Localization Style to Global English (0123). You can also override it per shortcode:
[indnpd_post_date lang="english"]
Or pass "english" as the third argument to indnpd_get_date().
Yes. Set your own Date Pattern in the settings, using these tokens: d (day), m (month number), M (month name), y (2-digit year), Y (4-digit year), l (weekday). For example, d M Y, l gives you २५ असार २०८१, मंगलबार.
You can also pass a format directly in the shortcode: [indnpd_post_date format="d M Y"]
Use the indesign_nepali_post_date_output filter. You get the HTML string, the BS date array, and the Unix timestamp.
add_filter( 'indesign_nepali_post_date_output', function( $html, $bs, $unix ) { return '<span class="nepali-badge">' . $html . '</span>'; }, 10, 3 );
Drop [indnpd_post_calendar] into any post, page, or widget. It shows the current BS month by default. Use the prev / next arrows in the header to browse.
To pin it to a specific month:
[indnpd_post_calendar year="2083" month="4" lang="english"]
Each past-or-current day cell links to the WordPress day archive for that Gregorian date (the same URL WordPress generates for /YYYY/MM/DD/). Clicking a day takes visitors to the list of posts published on that day. Future dates are never linked.
Yes. Open Nepali Post Date in the admin sidebar, go to the Post Calendar tab, and switch off the Post Links toggle on the calendar preview. Save Changes. The front-end calendar will then render as a plain, non-clickable calendar.
Yes. On the same Post Calendar tab, use the color picker on the calendar preview. The color drives the weekday header row, today's outline, and the linked-day text color. Save Changes and the front-end will pick it up.
Yes. Today (in Nepal time) is outlined with your chosen accent color, regardless of your WordPress site's timezone. The BS day always rolls at Nepal midnight.
Yes. Widgets that accept shortcodes render [indnpd_post_calendar] directly. In a template file:
<?php echo do_shortcode('[indnpd_post_calendar]'); ?>
Yes. It uses WordPress core's get_day_link(), which produces the standard /YYYY/MM/DD/ URL. Any theme that renders the day archive template (date.php, archive.php, or index.php) will handle those links correctly.
[indnpd_post_calendar] shortcode. Renders a monthly BS calendar. Days link to the WordPress day archive for that Gregorian date. Prev / next arrows navigate between BS months. Takes optional year, month, and lang attributes. Future dates are never linked.indesign_nepali_post_date_get(), indesign_nepali_post_date_today(), indesign_nepali_post_date_convert(). The old id_nepali_post_date_* names are kept as backward-compatible aliases so nothing you already wrote stops working.strtotime() interpreted the local-timezone datetime string as UTC, then wp_date() added the Nepal offset again, pushing evening dates to the next day. Now uses date_create($raw, wp_timezone()) to parse datetime strings correctly in the WordPress timezone with no offset drift.indesign_nepali_post_date_output filter.indnpd_get_date() helper and Manager::convert() static method.