# learnpress/4.4.3/inc/admin/meta-box/fields/toggle-switch.php

LearnPress – WordPress LMS Plugin for Create and Sell Online Courses, version 4.4.3. 25 lines.

- Page: https://pluginprobe.com/plugins/learnpress/4.4.3/code/inc/admin/meta-box/fields/toggle-switch.php
- Raw: https://pluginprobe.com/plugins/learnpress/4.4.3/raw/inc/admin/meta-box/fields/toggle-switch.php
- Modified: 2026-07-26T12:32:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/learnpress/4.4.3/code/inc/admin/meta-box/fields/toggle-switch.php#L10-L20`.

```php
<?php
/**
 * Template show toggle switch field
 */

defined( 'ABSPATH' ) || exit();

if ( ! isset( $data ) ) {
	return;
}
?>
<div class="lp-toggle-switch">
	<input class="lp-toggle-switch-input"
		name="<?php echo esc_attr( $data['name'] ?? '' ); ?>"
		id="<?php echo esc_attr( $data['id'] ?? '' ); ?>"
		<?php echo esc_attr( $data['value'] ? 'checked' : '' ); ?>
		type="checkbox" value="<?php echo esc_attr( $data['value'] ?? 0 ); ?>"
		<?php echo sanitize_text_field( $data['extra'] ?? '' ); ?>>
	<label class="lp-toggle-switch-label" for="<?php echo esc_attr( $data['id'] ?? '' ); ?>">
		<span class="toggle-on"></span>
		<span class="toggle-off"></span>
	</label>
	<span class="dashicons dashicons-update" style="display: none"></span>
</div>

```
