WordPress.org

Ready to get started?Download WordPress

Forums

Add post meta to theme? (4 posts)

  1. Travis
    Member
    Posted 1 year ago #

    is it possible to add post meta boxes in your theme functions.php file?

    I tried to use the example code here: http://codex.wordpress.org/Function_Reference/add_meta_box

    But it seems to only work as a plugin, and not in the theme directory

  2. pdobariya
    Member
    Posted 1 year ago #

    also works in your theme functions.php as plugin :)

  3. Travis
    Member
    Posted 1 year ago #

    I pasted the code in my functions.php file and I'm getting the following error with debug on:

    Notice: Undefined index: partners_noncename in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/theme/functions.php on line 71

  4. Travis
    Member
    Posted 1 year ago #

    Figured it out. Needed to check it nonce variable isset

    if ( !isset($_POST['my_meta_noncename']) || !wp_verify_nonce( $_POST['my_meta_noncename'], plugin_basename( __FILE__ ) ) )
    	  return;

Topic Closed

This topic has been closed to new replies.

About this Topic