Skip to content

Commit

Permalink
Merge pull request #16 from superwebshare/floating-bottom-position-se…
Browse files Browse the repository at this point in the history
…ttings-position-change

Floating bottom position settings position changed
  • Loading branch information
josevarghese authored Nov 30, 2022
2 parents a8a0869 + 85813ee commit 5be8bad
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 39 deletions.
60 changes: 26 additions & 34 deletions admin/class-super-web-share-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,59 +426,59 @@ function superwebshare_register_settings_inline() {
// Register Setting
register_setting(
'superwebshare_settings_inline_group', // Group name
'superwebshare_inline_settings', // Setting name = html form <input> name on settings form
'superwebshare_inline_settings', // Setting name = html form <input> name on settings form
'superwebshare_validater_and_sanitizer' // Input sanitizer
);
// Above & Below Post Share Settings Options
add_settings_section(
'superwebshare_inline_settings_section', // ID
__('Inline Content Settings', 'super-web-share'), // Title
'__return_false', // Callback Function
__('Inline Content Settings', 'super-web-share'), // Title
'__return_false', // Callback Function
'superwebshare_inline_settings_section' // Page slug
);
// Description
add_settings_field(
'superwebshare_inline_description_share', // ID
__('', 'super-web-share'), // Title
__('', 'super-web-share'), // Title
'superwebshare_inline_description_cb', // CB
'superwebshare_inline_settings_section', // Page slug
'superwebshare_inline_settings_section' // Settings Section ID
);
// Show Inline Content Share button
add_settings_field(
'superwebshare_inline_enable_share', // ID
__('Show Inline Content share button', 'super-web-share'), // Title
'superwebshare_inline_enable_cb', // CB
__('Show Inline Content share button', 'super-web-share'), // Title
'superwebshare_inline_enable_cb', // CB
'superwebshare_inline_settings_section', // Page slug
'superwebshare_inline_settings_section' // Settings Section ID
);
// Display settings of Share Button (Inline) Above and Below Post/Page Content
add_settings_field(
'superwebshare_inline_display_share', // ID
__('Post Types to show Inline share', 'super-web-share'), // Title
'superwebshare_inline_display_cb', // CB
__('Post Types to show Inline share', 'super-web-share'), // Title
'superwebshare_inline_display_cb', // CB
'superwebshare_inline_settings_section', // Page slug
'superwebshare_inline_settings_section' // Settings Section ID
);
// Position of Share Button (Inline)
add_settings_field(
'superwebshare_inline_position_share', // ID
__('Position of the button', 'super-web-share'), // Title
__('Position of the button', 'super-web-share'), // Title
'superwebshare_inline_button_position_cb', // CB
'superwebshare_inline_settings_section', // Page slug
'superwebshare_inline_settings_section' // Settings Section ID
);
// Text for share button
add_settings_field(
'superwebshare_inline_text_share', // ID
'superwebshare_inline_text_share', // ID
__('Button text', 'super-web-share'), // Title
'superwebshare_inline_button_text_cb', // CB
'superwebshare_inline_settings_section', // Page slug
'superwebshare_inline_settings_section' // Settings Section ID
);
// Inline Button Color
add_settings_field(
'superwebshare_inline_color_share', // ID
'superwebshare_inline_color_share', // ID
__('Button color', 'super-web-share'), // Title
'superwebshare_inline_button_color_cb', // CB
'superwebshare_inline_settings_section', // Page slug
Expand All @@ -488,8 +488,8 @@ function superwebshare_register_settings_inline() {
// Enable/Disable Share Button - AMP (1.4.4)
add_settings_field(
'superwebshare_inline_enable_amp_share', // ID
__('Show Inline on AMP Pages', 'super-web-share'), // Title
'inline_amp_enable_cb', // CB
__('Show Inline on AMP Pages', 'super-web-share'), // Title
'inline_amp_enable_cb', // CB
'superwebshare_inline_settings_section', // Page slug
'superwebshare_inline_settings_section' // Settings Section ID
);
Expand Down Expand Up @@ -529,44 +529,44 @@ function superwebshare_register_settings_floating() {
// Register Setting
register_setting(
'superwebshare_settings_floating_group', // Group name
'superwebshare_floating_settings', // Setting name = html form <input> name on settings form
'superwebshare_validater_and_sanitizer_floating' // Input sanitizer
'superwebshare_floating_settings', // Setting name = html form <input> name on settings form
'superwebshare_validater_and_sanitizer_floating' // Input sanitizer
);
// Floating Button Settings
add_settings_section(
'superwebshare_floating_settings_section', // ID
__('Floating Button Settings', 'super-web-share'), // Title
'__return_false', // Callback Function
__('Floating Button Settings', 'super-web-share'), // Title
'__return_false', // Callback Function
'superwebshare_floating_settings_section' // Page slug
);
// Description
add_settings_field(
'superwebshare_floating_description_share', // ID
__('', 'super-web-share'), // Title
__('', 'super-web-share'), // Title
'superwebshare_floating_description_cb', // CB
'superwebshare_floating_settings_section', // Page slug
'superwebshare_floating_settings_section' // Settings Section ID
);
// Enable/Disable the floating share button
add_settings_field(
'superwebshare_floating_enable_share', // ID
__('Show Floating share button', 'super-web-share'), // Title
'superwebshare_floating_enable_cb', // CB
__('Show Floating share button', 'super-web-share'), // Title
'superwebshare_floating_enable_cb', // CB
'superwebshare_floating_settings_section', // Page slug
'superwebshare_floating_settings_section' // Settings Section ID
);
// Floating Button color
add_settings_field(
'superwebshare_floating_color_share', // ID
__('Button color', 'super-web-share'), // Title
'superwebshare_floating_color_cb', // CB
'superwebshare_floating_color_cb', // CB
'superwebshare_floating_settings_section', // Page slug
'superwebshare_floating_settings_section' // Settings Section ID
);
// Floating Display Pages
add_settings_field(
'superwebshare_floating_display_share', // ID
__('Post Types for Floating button', 'super-web-share'), // Title
__('Post Types for Floating button', 'super-web-share'), // Title
'superwebshare_floating_display_cb', // CB
'superwebshare_floating_settings_section', // Page slug
'superwebshare_floating_settings_section' // Settings Section ID
Expand All @@ -579,27 +579,19 @@ function superwebshare_register_settings_floating() {
'superwebshare_floating_settings_section', // Page slug
'superwebshare_floating_settings_section' // Settings Section ID
);
// Position from Bottom
add_settings_field(
'superwebshare_floating_position_bottom_share', // ID
__('Position from bottom', 'super-web-share'), // Title
'superwebshare_floating_position_bottom_cb', // CB
'superwebshare_floating_settings_section', // Page slug
'superwebshare_floating_settings_section' // Settings Section ID
);
// Text for Floating Button (2.1)
add_settings_field(
'floating_button_text', // ID
__('Button text for Floating button', 'super-web-share'), // Title
'floating_button_text', // ID
__('Button text for Floating button', 'super-web-share'), // Title
'superwebshare_floating_button_text_cb', // CB
'superwebshare_floating_settings_section', // Page slug
'superwebshare_floating_settings_section' // Settings Section ID
);
// Enable/Disable Share Button - AMP (1.4.4)
add_settings_field(
'superwebshare_floating_enable_amp_share', // ID
__('Show floating on AMP Pages', 'super-web-share'), // Title
'floating_amp_enable_cb', // CB
__('Show floating on AMP Pages', 'super-web-share'), // Title
'floating_amp_enable_cb', // CB
'superwebshare_floating_settings_section', // Page slug
'superwebshare_floating_settings_section' // Settings Section ID
);
Expand Down
8 changes: 3 additions & 5 deletions admin/partials/super-web-share-admin-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ function superwebshare_floating_position_cb() {
</select>
</label> with

<input type="number" min="0" step="any" style="width:50px" name="superwebshare_floating_settings[floating_position_leftright]" id="superwebshare_floating_settings[floating_position_leftright]" value="<?php echo isset( $settings_floating['floating_position_leftright'] ) ? esc_html( $settings_floating['floating_position_leftright']) : '30'; ?>">px from left/right
<input type="number" min="0" step="any" style="width:50px" name="superwebshare_floating_settings[floating_position_leftright]" id="superwebshare_floating_settings[floating_position_leftright]" value="<?php echo isset( $settings_floating['floating_position_leftright'] ) ? esc_html( $settings_floating['floating_position_leftright']) : '30'; ?>">px from left/right,
<input type="number" min="0" step="any" style="width:50px" name="superwebshare_floating_settings[floating_position_bottom]" id="superwebshare_floating_settings[floating_position_bottom]" value="<?php echo isset( $settings_floating['floating_position_bottom'] ) ? esc_html( $settings_floating['floating_position_bottom']) : '30'; ?>">px from bottom<p>
<?php
}

Expand All @@ -193,10 +194,7 @@ function superwebshare_floating_position_cb() {
* @since 1.3
*/
function superwebshare_floating_position_bottom_cb() {
$settings_floating = superwebshare_get_settings_floating();
?>
<input type="number" min="0" step="any" style="width:50px" name="superwebshare_floating_settings[floating_position_bottom]" id="superwebshare_floating_settings[floating_position_bottom]" value="<?php echo isset( $settings_floating['floating_position_bottom'] ) ? esc_html( $settings_floating['floating_position_bottom']) : '30'; ?>">px<p>
<?php
return ""; // moved this field to superwebshare_floating_position_cb function since 2.4
}

/**
Expand Down

0 comments on commit 5be8bad

Please sign in to comment.