-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbip-pages-main-page.php
36 lines (29 loc) · 1.06 KB
/
bip-pages-main-page.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace BipPages;
// fallback for BIP main page in case block editor is disabled
function add_basic_main_page_data_fallback( $content ) {
$post = get_post();
if ( $post->ID == get_bip_main_page() && !has_block( 'bip-pages/org-info' ) ) {
$bip_logo_url = plugin_dir_url( __FILE__ ) . 'assets/bip-logos/bip-full-color-pl_min.png';
$bip_instruction_url = get_permalink( get_bip_instruction_page() );
ob_start();
include( __DIR__ . '/templates/bip-main-template.php' );
echo $content;
$content = ob_get_clean();
}
return $content;
}
add_filter('the_content', __NAMESPACE__ . '\add_basic_main_page_data_fallback' );
function is_bip_main_page_edit_screen() {
return isset( $_GET['action'] ) &&
$_GET['action'] == 'edit' &&
isset( $_GET['post'] ) &&
$_GET['post'] == get_bip_main_page();
}
function get_main_page_default_content() {
$bip_instruction_url = get_permalink( get_bip_instruction_page() );
// Polish only for now
ob_start();
include( 'boilerplate-text/bip-main-page-pl.php');
return ob_get_clean();
}