Fix floating widget in post password form

This commit is contained in:
Cooper Dalrymple
2026-06-09 13:19:51 -05:00
parent 6ced723e4f
commit cc135e0401
2 changed files with 12 additions and 3 deletions
+10 -1
View File
@@ -39,7 +39,10 @@ final class Widget {
if (!wp_script_is(self::HANDLE)) {
wp_enqueue_script(
self::HANDLE,
self::get_script_url()
self::get_script_url(),
args: [
'in_footer' => true
]
);
}
@@ -49,6 +52,9 @@ final class Widget {
self::get_floating_script_url(),
[
self::HANDLE
],
args: [
'in_footer' => true
]
);
}
@@ -186,6 +192,9 @@ final class Widget {
Plugin::get_url('assets/floating.js'),
[
self::FLOATING_HANDLE
],
args: [
'in_footer' => true
]
);
+2 -2
View File
@@ -28,14 +28,14 @@ final class PostPasswordForm extends Location {
#[Override]
public function activate(): void
{
add_filter('the_password_form', [$this, 'render_form']);
add_filter('the_password_form', [$this, 'render_form'], 10, 3);
add_action('login_form_postpass', [$this, 'process_form']);
}
public function render_form(string $output, WP_Post $post, string $invalid_password):string {
ob_start();
$this->render();
$output .= ob_get_clean();
$output = str_replace('</form>', ob_get_clean() . '</form>', $output);
if (Settings::is_widget_floating()) {
$output = Widget::set_button_floating($output);