-
AuthorPosts
-
June 20, 2016 at 2:21 pm #650818
hi I tried to change months name from the language file in wordpress, everything seems good but after few hours I notice that nomination became the old one. So I am asking if there is any function in the theme responsible to date format, then I can add my code
thank you
June 21, 2016 at 8:39 am #651334Hi marianea,
Could you provide us with a link to the site in question so that we can take a closer look please?
Regards,
RikardJune 21, 2016 at 8:29 pm #651698ok this is an example :
you will see the publish date in arabic, but this translation isnt used in all arabic countries, I need to change it. for this reason I re translated : the main languages files n wordpress and I inserted months title as I need. but after uploading the file, I notice that few hours ago, the old translation is back again.
So I think i have to insert a code manually in theme option to set date as I need.
I hope you understand what I mean
thank youJune 23, 2016 at 7:32 am #652526Hi,
What is the correct arabic date format? You can change the format in the Settings > General panel. Look for the Date Format and Time Format options. Set it to custom then refer to this link. https://codex.wordpress.org/Formatting_Date_and_Time
Best regards,
IsmaelJune 23, 2016 at 9:16 am #652556I dont mean date and time what I need is exactly months, let me give you a live example , April in arabic is نيسان ، but in gulf countries they say it ابريل
in arabic language file, they are using it on gulf way, I changed it, and re upload the language file, but still facing a problem that after 2 hours it’s auto changed.
what I need exactly is to insert a code in theme function to read my arabic months
something like :
$arabicmonth = array(“”,”كانون 2″,”شباط”,”آذار”,”نيسان”,”أيار”,”حزيران”,”تموز”,”آب”,”أيلول”,”تشرين 1″,”تشرين 2″,” كانون 1″);
$n = get_the_time(‘n’);
$since = get_the_time(j .” $arabicmonth[$n] “. Y);June 24, 2016 at 6:58 am #652872Hey!
I’m not sure how you can implement but you can modify the includes > loop-index.php file. Look for this code:
echo "<time class='date-container minor-meta updated' >".get_the_time(get_option('date_format'))."</time>";
And for some reason, I can’t edit the $arabicmonth array in my editor properly. Try this filter in the functions.php file:
function ava_convert_months_to_arabic( $string ) { $arabic_month = array("", "Test 1", "Test 2"); $english_month = array("", "January", "May"); return str_replace($english_month, $arabic_month, $string); } add_filter( 'get_the_time', 'wpse_convert_arabic_time' ); add_filter( 'get_the_date', 'wpse_convert_arabic_time' ); function wpse_convert_arabic_time( $the_time ) { $the_time = ava_convert_months_to_arabic( $the_time ); return $the_time; }
Adjust the value of these arrays:
$arabic_month = array("", "Test 1", "Test 2"); $english_month = array("", "January", "February");
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.