| 1 |
<?php |
| 2 |
/** |
| 3 |
* Functions to improve compatibility with Twenty Seventeen. |
| 4 |
* |
| 5 |
* @package Charitable/Functions/Compatibility |
| 6 |
* @author David Bisset |
| 7 |
* @copyright Copyright (c) 2023, WP Charitable LLC |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.6.22 |
| 10 |
* @version 1.6.22 |
| 11 |
*/ |
| 12 |
|
| 13 |
// Exit if accessed directly. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* In Twenty Seventeen, add a hidden sidebar to avoid a Javascript error. |
| 20 |
* |
| 21 |
* On the donation page, there is no sidebar, and Twenty Seventeen throws |
| 22 |
* an error as a result, which can pause other Javascript processing. |
| 23 |
* |
| 24 |
* @see https://core.trac.wordpress.org/ticket/41050 |
| 25 |
* |
| 26 |
* @since 1.6.22 |
| 27 |
* |
| 28 |
* @return void |
| 29 |
*/ |
| 30 |
function charitable_compat_twentyseventeen_missing_sidebar() { |
| 31 |
if ( charitable_is_page( 'campaign_donation', array( 'strict' => true ) ) ) { |
| 32 |
echo '<div id="secondary" class="charitable-hidden"></div>'; |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
add_action( 'charitable_donation_form_after', 'charitable_compat_twentyseventeen_missing_sidebar' ); |
| 37 |
|