This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wptrt_add_meta_box() { | |
add_meta_box( 'wptrt-sample-meta-box', esc_html__( 'WPTRT Sample Meta Box', 'wptrt' ), 'wptrt_print_meta_box', 'post' ); | |
} | |
add_action( 'add_meta_boxes', 'wptrt_add_meta_box' ); | |
function wptrt_print_meta_box() { | |
wp_nonce_field( 'wptrt-post-meta-box-save', 'wptrt-post-meta-box-nonce' ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hackish solution to distinguish between block renders on the front end, and the back end. | |
* | |
* In the admin, the global `$wp_query` does not contain a query. We use this to determine whether a rendering is | |
* happening on the front end or the back end. | |
* | |
* @return bool Whether we're in the admin or on the front end. | |
*/ | |
function fk_is_front_end_query() { |