Inserting custom fields using quick press (1 post)

  1. bakedbean
    Posted 4 years ago #


    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 '
        <select name="category[]" size="10" MULTIPLE>';
        foreach(get_categories() as $cat)
        echo '<option value="'. $cat->cat_ID . '">'.$cat->cat_name.'</option>';
      echo  '
    	<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 style="margin:0px 0px 10px 0px;">
    	<label>End Date</label>
            <input type="text" name="end-date" >
            <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 style="margin:0px 0px 10px 0px;">
    	<label>Start Date</label>
            <input type="text" name="start-date">
    	<div class="hide-if-no-js" style="margin: 0 0 .5em 5em;padding:8px 10px 5px 5px;">
    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') ) {

    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?


Topic Closed

This topic has been closed to new replies.

About this Topic