<?php
function prfx_custom_meta()
{
add_meta_box(
'some_meta_box_name'
,__( 'Some Meta Box Headline', 'plugin_textdomain' )
,'render_meta_box_content' //this is callback function.
,'post_type'
,'advanced'
,'high'
);
}
add_action( 'add_meta_boxes', 'prfx_custom_meta' );
?>
I used the above code to create a metabox in Wordpress. But , for that code it doesn't showing up couldn't find the solution. kindly suggest any ideas for that problem .
It all depends on where you want the metabox to appear.
If you want it to appear on posts then you need to use
And then create metabox with
If you want it on page then you can create it like above but with page instead of post
You can hook to
admin_init
ofadd_meta_boxes
hooks. See here for more explanation.You can put it in your
functions.php
file or you can set it in separate.php
file and call it infunctions.php
with something like:This will include
metaboxes.php
that are located in the/include
directory of your theme.