| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package Polylang |
| 4 |
*/ |
| 5 |
|
| 6 |
namespace WP_Syntex\Polylang\Blocks; |
| 7 |
|
| 8 |
use WP_Syntex\Polylang\Blocks\Language_Switcher\Standard\Block as Standard_Block; |
| 9 |
use WP_Syntex\Polylang\Blocks\Language_Switcher\Navigation\Block as Navigation_Block; |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; // Don't access directly. |
| 13 |
} |
| 14 |
|
| 15 |
add_action( |
| 16 |
'pll_init', |
| 17 |
function ( $polylang ) { |
| 18 |
if ( $polylang->model->has_languages() ) { |
| 19 |
$polylang->switcher_block = ( new Standard_Block( $polylang ) )->init(); |
| 20 |
$polylang->navigation_block = ( new Navigation_Block( $polylang ) )->init(); |
| 21 |
} |
| 22 |
} |
| 23 |
); |
| 24 |
|