Fix floating widget in post password form
This commit is contained in:
+10
-1
@@ -39,7 +39,10 @@ final class Widget {
|
|||||||
if (!wp_script_is(self::HANDLE)) {
|
if (!wp_script_is(self::HANDLE)) {
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
self::HANDLE,
|
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::get_floating_script_url(),
|
||||||
[
|
[
|
||||||
self::HANDLE
|
self::HANDLE
|
||||||
|
],
|
||||||
|
args: [
|
||||||
|
'in_footer' => true
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -186,6 +192,9 @@ final class Widget {
|
|||||||
Plugin::get_url('assets/floating.js'),
|
Plugin::get_url('assets/floating.js'),
|
||||||
[
|
[
|
||||||
self::FLOATING_HANDLE
|
self::FLOATING_HANDLE
|
||||||
|
],
|
||||||
|
args: [
|
||||||
|
'in_footer' => true
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ final class PostPasswordForm extends Location {
|
|||||||
#[Override]
|
#[Override]
|
||||||
public function activate(): void
|
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']);
|
add_action('login_form_postpass', [$this, 'process_form']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render_form(string $output, WP_Post $post, string $invalid_password):string {
|
public function render_form(string $output, WP_Post $post, string $invalid_password):string {
|
||||||
ob_start();
|
ob_start();
|
||||||
$this->render();
|
$this->render();
|
||||||
$output .= ob_get_clean();
|
$output = str_replace('</form>', ob_get_clean() . '</form>', $output);
|
||||||
|
|
||||||
if (Settings::is_widget_floating()) {
|
if (Settings::is_widget_floating()) {
|
||||||
$output = Widget::set_button_floating($output);
|
$output = Widget::set_button_floating($output);
|
||||||
|
|||||||
Reference in New Issue
Block a user