• Resolved project2021

    (@project2021)


    Hello
    I want to change the word “entries” in the sentence “show all entries” in my tables to another word like “countries”. How Can I do this please? it’s very important and urgent

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author wpDataTables

    (@wpdatatables)

    Hello there.

    Thank you for reaching out to us.
    To change that text, you need to add the following script in the functions.php file of your theme or the child theme (depending on what you’re using):

    add_filter( 'wpdatatables_filter_table_description', 'changeDisplayLengthText', 10, 3 );
    function changeDisplayLengthText( $object, $table_id, $wpDataTableOBJ ){
        if($table_id == 1){
            if (!isset($object->dataTableParams->oLanguage)) {
                $object->dataTableParams->oLanguage = new stdClass();
            }
            $object->dataTableParams->oLanguage->sLengthMenu="Show _MENU_ countries";
        }
    
        return $object;
    }

    “_MENU_” needs to stay in place because it’s replaced with the select, and of course, you need to change the table_id == 1 to the actual ID of the table you need this for.

    We hope that helps.

    Thread Starter project2021

    (@project2021)

    Hello @wpdatatables
    Thank you very much for your support. The code worked perfectly for me.
    I have another question @wpdatatables . I have now to translate the table informations (the word “seach”+ “show all entries” ) in another language (arabic).
    I suppose I can use the same code to translate “show” and “entries” but what about “search” and “entries”.
    Ps: I can not use the default parameter of language in the plugin because my website is in 3 languages so I have to change the words in code.

    Plugin Author wpDataTables

    (@wpdatatables)

    Hello again.

    We’re glad to hear the code worked!

    As for changing the strings in the code, you should be able to find them in ../wp-content/plugins/wpdatatables/source/class.wdttools.php file.

    Please let us know if there’s anything else we can do for you.

    Thread Starter project2021

    (@project2021)

    Thank you again for your support. I’ve change the words using the same first code but I still can not change the word “all” in the menu of entries . How can I do this.

    This is what I’ve done before to change the “search and entries”

    add_filter( 'wpdatatables_filter_table_description', 'changeWordForArabic', 10, 3 );
    function changeWordForArabic( $object, $table_id, $wpDataTableOBJ ){
        if($table_id == 10 || $table_id == 11 ){
            if (!isset($object->dataTableParams->oLanguage)) {
                $object->dataTableParams->oLanguage = new stdClass();
            }
            $object->dataTableParams->oLanguage->sSearch="?????";
            $object->dataTableParams->oLanguage->sLengthMenu="?????_MENU_???????? ";
        
            
        }
    
        return $object;
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to change the word “entries” in the table’ is closed to new replies.