I use a wp Plugin where you simply can create tables in the admin area and then in the front end you can add something to the table using a form, there I have a Button with the Text (New entry) and here is my problem, I have on every table the same text. for example, if I have a table with rows of Cars I want the Button to be 'Add Car', not New entry.

I have found the file where the Text is located, also beside New entry, there is also the text 'Edit' & 'Delete'

if ($this->isEditable()) {
            (!isset($obj->dataTableParams->buttons)) ? $obj->dataTableParams->buttons = array() : '';
                    'text' => __('New entry', 'wpdatatables'),
                    'className' => 'new_table_entry DTTT_button DTTT_button_new'
                    'text' => __('Edit', 'wpdatatables'),
                    'className' => 'edit_table DTTT_button DTTT_button_edit',
                    'enabled' => false
                    'text' => __('Delete', 'wpdatatables'),
                    'className' => 'delete_table_entry DTTT_button DTTT_button_delete',
                    'enabled' => false

            $obj->advancedEditingOptions = array();
            $obj->advancedEditingOptions['aoColumns'] = json_decode('[' . $this->getColumnEditingDefinitions() . ']');

Now from what I can see in the MySQL Table the , 'wpdatatables' defines that this belongs to current table, in MySQL I can see this with other plugin settings, for example, there is one setting 'Make Table Responsive' and it has in the code also the , 'wpdatatables' and in the Database I see in this setting a true so (1). But since the text is hardcoded here in the code I'm not sure why there is , 'wpdatatables' maybe they prepared this for the future for something.

Now I want to create an HTML input field in the Settings part in the admin area of the Plugin and the text of this field need to hook into this .php file where the current text is hardcoded. So my problem is since I'm new to PHP and PHP in WP how do I connect this 2 files since the Setting page file and this file with the text are 2 separate PHP files, and do this value need to be saved in MySQL or is there no need to think about MySQL for a simple text change? What options do I have?

Here the Settings PHP File where I want to add my input field

<div class="toggle-switch" data-ts-color="blue">
<label for="wdt-responsive"
class="ts-label"><?php _e('Allow collapsing on mobiles and tablets', 'wpdatatables'); ?></label>
<input id="wdt-responsive" type="checkbox" hidden="hidden" checked="checked">
<label for="wdt-responsive" class="ts-helper"></label>

<div class="text-input">
<input type="text">

How do I start connecting this, Is assigning the input value to a variable and adding it to the file where it is hardcoded the right way? I need some basic example of where to start because I started learning the WP structure a few days ago. I mean I use it for over 10 years but it is the first time I want to modify a Plugin and dive in into some PHP in WP. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.