Created
July 28, 2013 19:43
-
-
Save fdaciuk/6099825 to your computer and use it in GitHub Desktop.
Adicionar metaboxes a pages específicas no WP
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 | |
/* | |
Adicionar metabox à páginas específicas | |
*/ | |
function my_meta_setup_1() { | |
// criação da metabox | |
} | |
function especific_metabox_pages() { | |
$post_ID = $_GET['post'] ? $_GET['post'] : $_POST['post_ID']; | |
$post = get_post( $post_ID ); | |
$slug = $post->post_name; | |
if( $slug === 'pageslug' ) { | |
add_meta_box( 'my_all_meta_1', 'My Custom Meta Box 1', 'my_meta_setup_1', 'page', 'normal', 'high' ); | |
} | |
} | |
add_action( 'add_meta_boxes', 'especific_metabox_pages' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment