New feature to apply Hijri dates in frontend or admin dashboard only
-
Alsalam alaykum,
I would like to suggest a new feature, an option to apply the Hijri dates in frontend or backend(admin dashboard) only.
So all other options will applied to frontend or backend depend on the user choice, for example the “Force all dates to return Hijri dates” option will be applied in frontend only if the user chose to be frontend only.
To do that i suggest to do the following:
- Stop updating the WordPress’s “date_format” option and use a custom option to save the user format and then use the filter “option_date_format” to overwrite the date format with the format the user has been chosen
- Make a select option in settings page to make the ability to choose to apply the Hijri date in frontend only or backend only or both and default to be both
In my case i need to keep the dates in dashboard in gregorian and force all dates in frontend to be in Hijri, so for now i made a plugin has two filters to achieve this goal:
// force gregorian date in wp-admin while activating WP-Hijri plugin function my_force_gregorian_date_in_admin( $value, $option ) { if ( is_admin() ) { $value = 'F j, Y'; } return $value; } add_filter( 'option_date_format', 'my_force_gregorian_date_in_admin', 10, 2 ); function my_stop_force_hijri_date_in_admin( $value, $option ) { if ( is_admin() ) { $settings = json_decode($value, TRUE); $settings['force_hijri'] = false; $value = json_encode($settings); } return $value; } add_filter( 'option_Hijri_Settings', 'my_stop_force_hijri_date_in_admin', 10, 2 );
- The topic ‘New feature to apply Hijri dates in frontend or admin dashboard only’ is closed to new replies.