Last active
January 18, 2018 17:46
-
-
Save obiPlabon/91484a13841acd02707949e47513735e to your computer and use it in GitHub Desktop.
Use this condition if you wanna do anything only on static home page
This file contains hidden or 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 op_register_metaboxes( $options ) { | |
| $options = array(); | |
| if ( 'page' === get_option( 'show_on_front' ) | |
| && ( $page_id = get_option( 'page_on_front' ) ) | |
| && isset( $_GET['post'] ) | |
| && $_GET['post'] === $page_id ) { | |
| $options[] = array( | |
| 'id' => 'op_home_page_only_metabox', | |
| 'title' => 'Page Settings', | |
| 'post_type' => 'page', | |
| 'context' => 'normal', | |
| 'priority' => 'high', | |
| 'sections' => array( | |
| // Sections config goes here | |
| ), | |
| ) | |
| } | |
| return $options; | |
| } | |
| add_filter( 'cs_metabox_options', 'op_register_metaboxes' ); |
This file contains hidden or 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 | |
| if ( 'page' === get_option( 'show_on_front' ) | |
| && ( $page_id = get_option( 'page_on_front' ) ) | |
| && isset( $_GET['post'] ) | |
| && $_GET['post'] === $page_id ) { | |
| // do your stuffs here | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment