$svg) {
// Sanitize the name and path for each SVG
if (isset($svg['name'])) {
$input[$key]['name'] = sanitize_text_field($svg['name']);
}
if (isset($svg['path'])) {
$input[$key]['path'] = sanitize_textarea_field($svg['path']);
}
}
}
return $input;
}
// Existing function to render the theme settings page
function render_lcp_theme_settings_page() {
?>
';
}
// Optional: Sanitization callback function
function lcp_theme_settings_sanitize( $input ) {
// Ensure that only the expected values are saved (e.g., bool for the checkbox)
if ( isset( $input['enable_key_points_meta'] ) ) {
$input['enable_key_points_meta'] = (bool) $input['enable_key_points_meta']; // Convert to boolean
}
return $input;
}
// The callback function to display the custom code inserterpage content
function lcp_custom_code_inserter_page() {
// Get the stored options from wp_options
$custom_code = get_option( 'custom_code_options', array() );
?>
Custom Code Settings
' . $custom_code['js_header'] . '';
}
// Check and output CSS for header
if ( isset( $custom_code['css_header'] ) && ! empty( $custom_code['css_header'] ) ) {
echo '';
}
}
// Check if the hook is for the footer
if ($hook == "footer") {
// Check and output JS for footer
if ( isset( $custom_code['js_footer'] ) && ! empty( $custom_code['js_footer'] ) ) {
echo '';
}
}
}
}
// Attach to wp_head and wp_footer, passing the location as a parameter
add_action( 'wp_head', function() {
lcp_custom_code_output('header');
});
add_action( 'wp_footer', function() {
lcp_custom_code_output('footer');
});
// Hook into wp_footer to add the login form in the footer
function add_login_form_to_footer() {
?>