WordPress.org

Ready to get started?Download WordPress

Forums

Reusable Custom WordPress Meta Boxes (1 post)

  1. obidos
    Member
    Posted 1 year ago #

    Hi all,

    I am having a some trouble getting this code to work:-

    I have installed it as instructed. I copied the custommetabox folder to my theme and used this to load the scrips:-

    wp_enqueue_style('custommeta', get_template_directory_uri().'/metaboxes/meta_box.php');

    In my themes functions file I added the following from the examples provided:-

    $prefix = 'sample_';
    
    $fields = array(
    	array( // Text Input
    		'label'	=> 'Text Input', // <label>
    		'desc'	=> 'A description for the field.', // description
    		'id'	=> $prefix.'text', // field id and name
    		'type'	=> 'text' // type of field
    	),
    	array( // Textarea
    		'label'	=> 'Textarea', // <label>
    		'desc'	=> 'A description for the field.', // description
    		'id'	=> $prefix.'textarea', // field id and name
    		'type'	=> 'textarea' // type of field
    	)
    );

    Then I loaded the metaboxes the same way as my custom posts:-

    function add_custom_meta()
    {
    add_meta_box( 'sample_box', 'Sample Box', $fields, 'page', true );
    }
    add_action('add_meta_boxes', 'add_custom_meta');

    I get the following errors in the admin area:-
    SCREAM: Error suppression ignored for
    Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in C:\wamp\www\psytech\wp-admin\includes\template.php on line 927

    Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic