Created
November 13, 2017 19:05
-
-
Save nandomoreirame/005521996889ff253b3981e4ec383ca5 to your computer and use it in GitHub Desktop.
Odin_Metabox on about 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 about_metabox_page () { | |
| $hasGetMethod = (isset($_GET['post']) && !empty($_GET['post'])); | |
| $hasPostMethod = (isset($_POST['post_ID']) && !empty($_POST['post_ID'])); | |
| $about_pages_arr = array( | |
| 'sobre', | |
| 'sobre-nos', | |
| 'sobre-a-grgit', | |
| 'quem-somos', | |
| 'about', | |
| 'about-us' | |
| ); | |
| if ($hasGetMethod || $hasPostMethod) { | |
| $post_ID = $hasGetMethod ? $_GET['post'] : $_POST['post_ID']; | |
| $post = get_post( $post_ID ); | |
| $slug = $post->post_name; | |
| if( in_array( $slug, $about_pages_arr ) ) { | |
| /* Metaboxes for about page */ | |
| $about_metabox = new Odin_Metabox( | |
| 'about', | |
| 'Missão/Visão/Valores', | |
| 'page', | |
| 'normal', | |
| 'high' | |
| ); | |
| $about_metabox->set_fields( | |
| array( | |
| array( | |
| 'id' => 'about_missao', | |
| 'label' => __( 'Missão', 'grgit' ), | |
| 'type' => 'textarea' | |
| ), | |
| array( | |
| 'id' => 'about_visao', | |
| 'label' => __( 'Visão', 'grgit' ), | |
| 'type' => 'textarea' | |
| ), | |
| array( | |
| 'id' => 'about_valores', | |
| 'label' => __( 'Valores', 'grgit' ), | |
| 'type' => 'textarea' | |
| ) | |
| ) | |
| ); | |
| } | |
| } | |
| } | |
| add_action( 'init', 'about_metabox_page' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment