Skip to content

Instantly share code, notes, and snippets.

@fdaciuk
Created July 28, 2013 19:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdaciuk/6099825 to your computer and use it in GitHub Desktop.
Save fdaciuk/6099825 to your computer and use it in GitHub Desktop.
Adicionar metaboxes a pages específicas no WP
<?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