Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Okay so I'm trying to render a meta box.

This is what I have so far, trying to keep it as basic as possible:

add_action('load-post.php', 'ad_templates_callback' );
add_action('load-post-new.php', 'ad_templates_callback' );

function ad_templates_callback(){
    add_action('add_meta_boxes', 'ad_templates_add_meta_box');
    add_action('save_post', 'ad_templates_save_post');
}

function ad_templates_add_meta_box(){
    add_meta_box( 'ad_templates', 'Template Options', 'ad_templates_render', 'page', 'normal', 'default');
}

function ad_templates_render($object, $box){
    wp_nonce_field( basename(__FILE__), 'ad_templates_nonce' );
    global $post_id;
    ?>
        <p>
            balblabl test
        </p>
    <?php
}
function ad_templates_save_post(){
    //nothing
}

I have no idea why, but it doesn't show up on either the New Page or existing Page pages.

I've tried it with removing the 'load-post.php' hooks and I've tried it with using Posts instead of Pages.

I've copied this code from an earlier WP theme I've created (which successfully shows the boxes), with a slight edit to the theme slug. So somewhere, somehow I'm missing something.

share|improve this question
add comment

1 Answer

Never mind I just went full potato and forgot to include the file into my functions.php

Is there any way to delete this question?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.