PHP code example of roelmagdaleno / wp-settings-page-fields
1. Go to this page and download the library: Download roelmagdaleno/wp-settings-page-fields library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
roelmagdaleno / wp-settings-page-fields example snippets
$element = new Element( $id, $settings, $option_name );
use Roel\WP\Settings\Elements\{
Checkbox,
Text,
};
$settings = array(
new Checkbox( 'allow-user', array(
'label' => 'Allow user?',
'description' => 'Allow user to do current action.',
), 'rmr_settings' ),
new Text( 'api-key', array(
'label' => 'API Key',
'description' => 'Insert the API Key.',
), 'rmr_settings' ),
);
foreach ( $settings as $setting ) {
add_settings_field(
$setting->id(),
$setting->label(),
array( $setting, 'print' ),
'your-page'
);
}
use Roel\WP\Settings\Elements\Text;
$settings = array(
'label' => 'API Key',
'description' => 'Insert your API Key in this form field.',
);
$text = new Text( 'api-key', $settings, 'rmr_settings' );
echo $text->render();
use Roel\WP\Settings\Elements\Text;
$settings = array(
'label' => 'API Key',
'description' => 'Insert your API Key in this form field.',
);
$text = new Text( 'api-key', $settings, 'rmr_settings' );
$text->print();
use Roel\WP\Settings\Elements\Text;
$settings = array(
'label' => 'API Key',
'description' => 'Insert your API Key in this form field.',
);
$text = new Text( 'api-key', $settings, 'rmr_settings' );
echo $text;
use Roel\WP\Settings\Elements\Text;
$settings = array(
'label' => 'API Key',
'description' => 'Insert your API Key in this form field.',
);
$text = new Text( 'api-key', $settings, 'rmr_settings' );
echo $text->render();