Skip to content

Instantly share code, notes, and snippets.

Zeeshan Asif zeesaying

View GitHub Profile
@zeesaying
zeesaying / function.php
Created Jul 10, 2017
Custom meta box with custom filed for specific page template.
View function.php
<?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' );
You can’t perform that action at this time.