• Hello,

    i’m attempting to modify quick press so that we can enter the custom fields ‘Start Date’, ‘End Date’ and so that we can assign the category when a new post is added. I have successfuly added the form fields using the code below.

    function __quickpress_custom() {
    	if(!function_exists('is_admin') || !is_admin()) return;
    	// Parameters for wp_dropdown_categories
    
    echo '
    
        <div>
        <select name="category[]" size="10" MULTIPLE>';
    
        foreach(get_categories() as $cat)
    {
        echo '<option value="'. $cat->cat_ID . '">'.$cat->cat_name.'</option>';
    }
      echo  '
          </select>
    </div>
    
        <div>
    	<h4 id="custom-label" style="float: none; display:block; width: 103px; margin: 0 0 10px -27px;"><label for="post_custom">Custom Fields</label></h4>
    	</div>
            <div style="margin:0px 0px 10px 0px;">
    	<label>End Date</label>
            <input type="text" name="end-date" >
    	</div>
            <div style="margin:0px 0px 10px 0px;">
    	<label style="display:block; margin:15px 0px 5px 0px;">Hide Main image</label>
            <input type="radio" name="main-image" value="yes" />Yes
            <input type="radio" name="main-image" value="no" checked="checked" />No
    	</div>
            <div style="margin:0px 0px 10px 0px;">
    	<label>Start Date</label>
            <input type="text" name="start-date">
    	</div>
    	<div class="hide-if-no-js" style="margin: 0 0 .5em 5em;padding:8px 10px 5px 5px;">
    	';
    	return;
    }
    if(is_admin() || $query->is_admin) {
    	$here = array( basename($_SERVER['REQUEST_URI']), basename($_SERVER['SCRIPT_FILENAME']) );
    
    	 	if( ( $here[0] == 'index-extra.php?jax=dashboard_quick_press'  || $here[0] ==  'post.php') && ( $here[1] == 'index-extra.php'  || $here[1] == 'post.php') ) {
    		add_action('media_buttons','__quickpress_custom');
    	}
    
    	unset($here);
    }

    The problem is actually getting the fields custom field data to register when the post is created. i have tried using the hooks wp_insert_post, quick_edit_custom_box and publish_page with a custom built function wich utilizes the wp_update_post() function. When it runs with the wp_update_post() it goes into a permanent loop. I’ve pretty much tried everything else i can think of. There doesn’t appear to be any info on the codex etc regarding this as i have had a good look. has anyone attempted the same thing and can anyone suggest a solution?

    Thanks

  • The topic ‘Inserting custom fields using quick press’ is closed to new replies.