Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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

    #651334

    Hi marianea,

    Could you provide us with a link to the site in question so that we can take a closer look please?

    Regards,
    Rikard

    #651698

    ok 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 you

    #652526

    Hi,

    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,
    Ismael

    #652556

    I 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);

    #652872

    Hey!

    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

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.