Changes to lcp-button

This commit is contained in:
Jeremy Rangel
2024-12-31 18:53:46 -08:00
parent 2df16e37a8
commit 741d39a962
94 changed files with 1159 additions and 138 deletions

View File

@ -14,15 +14,7 @@ function lcp_backend_pages() {
);
// Register the Custom Code settings page
add_menu_page(
'Custom Code Inserter', // Page title
'Code Inserter', // Menu title
'manage_options', // Capability required - admin only
'lcp-code-inserter', // Menu slug
'custom-code-inserter', // Callback function
'', // Icon
25
);
}
add_action( 'admin_menu', 'lcp_backend_pages' );
// Function to render the theme settings page
@ -169,44 +161,6 @@ function lcp_enable_highlight_to_share() {
// 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() );
?>
<div class="wrap">
<h1>Custom Code Settings</h1>
<form method="post" action="options.php">
<?php settings_fields( 'custom_code_group' );
if (defined('LCP_DISABLE_CODE_INSERTER') && LCP_DISABLE_CODE_INSERTER === true) {
echo "<h2 style=\"margin:10px 5px\"> LCP Custom Code Inserter is currently disabled. </h2>
<h3 style=\"margin:5px 5px\"> You can add and modify code snippets, but they will not be in effect. </h3> ";
}
?>
<table class="form-table">
<tr valign="top">
<th scope="row">CSS in Header</th>
<td><textarea name="custom_code_options[css_header]" rows="10" cols="50"><?php echo esc_textarea( isset( $custom_code['css_header'] ) ? $custom_code['css_header'] : '' ); ?></textarea></td>
</tr>
<tr valign="top">
<th scope="row">JavaScript in Header</th>
<td><textarea name="custom_code_options[js_header]" rows="10" cols="50"><?php echo esc_textarea( isset( $custom_code['js_header'] ) ? $custom_code['js_header'] : '' ); ?></textarea></td>
</tr>
<tr valign="top">
<th scope="row">JavaScript in Footer</th>
<td><textarea name="custom_code_options[js_footer]" rows="10" cols="50"><?php echo esc_textarea( isset( $custom_code['js_footer'] ) ? $custom_code['js_footer'] : '' ); ?></textarea></td>
</tr>
</table>
<?php submit_button(); ?>
</form>
</div>
<?php
}
// Register a custom code setting in wp_options to store the custom code snippets
function lcp_custom_code_settings_init() {
@ -303,6 +257,7 @@ function render_lcp_theme_settings_page() {
// Output necessary settings fields for the 'Icons' tab
settings_fields('lcp_theme_settings_group');
do_settings_sections('lcp_theme_settings_page'); // This outputs all the fields defined by add_settings_field
mytheme_display_icon_sets();
?>
<?php submit_button(); ?>
@ -368,3 +323,9 @@ function lcp_wp_head_hooks(){
}
add_action('wp_head', 'lcp_wp_head_hooks');
/* ICONS */