Invalid file type when using wp_upload_bits to upload PDF to a custom post type

Ahh I figured it out. After echoing and print_r every single thing I could I figured out that this line: $uploaded_file = wp_upload_bits($_FILES[$pdf_field[‘name’]], null, file_get_contents($_FILES[$pdf_field[‘tmp_name’]])); Needed to be changed to this: $uploaded_file = wp_upload_bits($pdf[‘name’], null, file_get_contents($pdf[‘tmp_name’])); The original problem I had in the first place was not being able to pass my $_FILE array directly … Read more

Understanding WordPress’ post type support

When you register post type, you can choose what support you need. For Example: function codex_custom_init() { $args = array( ‘public’ => true, ‘label’ => ‘Books’, ‘supports’ => array( ‘title’, ‘editor’ ) ); register_post_type( ‘book’, $args ); } add_action( ‘init’, ‘codex_custom_init’ ) In this way you will create post type Books only with Title Option … Read more

Change the title of an Administration Panel

Look for add_meta_box or grep the Lucidbox directory for the metabox title– “Lucidpress Options”. It shouldn’t be too hard to find. As I don’t use that theme, or any other publicly released theme, I don’t know what else to say to you.

The $post variable – Did I get the grasp of how the Backend actions get parsed?

As I’ve already wrote in question comments, at the very beginning of creating the new post or page first choose a template and save as draft. Meta box will appear after save if right template is used. <?php add_action( ‘add_meta_boxes’, ‘my_add_meta_box’ ); function my_add_meta_box() { // get template file name $template_basename = wp_basename( get_page_template() ); … Read more

Custom metabox not working

Problem #1: First problem: inside home-meta.php, pull all of your add_meta_box() calls outside of the add_meta_boxes_home() callback, and get rid of the callback and add_action() call. You handle this already, with the add_meta_boxes_page callback in functions.php, that includes home-meta.php. Problem #2: Warning: Invalid argument supplied for foreach() in /Users/[my_mac]/Sites/[site_dir]/wp-content/themes/[site_theme]/metaboxes/home-meta.php on line 224 Assuming that this … Read more

save_post action inside a custom metabox class not working

I have modified your code as following and it is working for me. I have removed the constructor from your code and added the code in method and called that method using object. if (is_admin()){ add_action(‘load-post.php’, array(‘Mighty_Metabox’ , ‘Custom_Mighty_Metabox’)); } //the class class Mighty_Metabox{ //the vars public $id = false; public $title = false; public … Read more