Skip to content

Instantly share code, notes, and snippets.

View zeesaying's full-sized avatar

Zeeshan Asif zeesaying

View GitHub Profile
@zeesaying
zeesaying / function.php
Created July 10, 2017 16:03
Custom meta box with custom filed for specific page template.
<?php
// ADD THIS CODE IN FUNCTION.PHP FILE.
add_action( 'add_meta_boxes', 'cd_meta_box_add' );
function cd_meta_box_add()
{
//Replace with your Template file
if ( 'home.php' == get_post_meta( $post->ID, '_wp_page_template', true ) ) {
add_meta_box( 'my-meta-box-id', 'My First Meta Box', 'cd_meta_box_cb', 'page', 'normal', 'high' );