Created
February 4, 2011 05:12
-
-
Save zacparker/810767 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- New Post Form --> | |
<div id="postbox"> | |
<form id="new_post" name="new_post" method="post" action=""> | |
<p><label for="submitter">Submitted By</label><br /> | |
<input type="text" id="submitter" value="" tabindex="1" size="20" name="submitter" /> | |
</p> | |
<p><label for="email">Email Address</label><br /> | |
<input type="text" id="email" value="" tabindex="2" size="20" name="email" /> | |
</p> | |
<p><label for="title">Song Title</label><br /> | |
<input type="text" id="title" value="" tabindex="3" size="20" name="title" /> | |
</p> | |
<p><label for="composer">Composed By</label><br /> | |
<input type="text" id="composer" value="" tabindex="4" size="20" name="composer" /> | |
</p> | |
<p><label for="performer">Performed By</label><br /> | |
<input type="text" id="performer" value="" tabindex="5" size="20" name="performer" /> | |
</p> | |
<p><label for="tablature">Song Body</label><br /> | |
<textarea id="tablature" tabindex="6" name="tablature" cols="50" rows="6"></textarea> | |
</p> | |
<p><?php wp_dropdown_categories( 'show_option_none=Category&tab_index=4&taxonomy=category' ); ?></p> | |
<p><select name='categories' class='tdomf_categories' size='1' > | |
<option value="8" <?php if( (is_array($defcat) && in_array(8, $defcat)) || ( 8 == $defcat ) ) { echo ' selected="selected" '; } ?>Hawaiian Mele</option> | |
<option value="9"<?php if( (is_array($defcat) && in_array(9, $defcat)) || ( 9 == $defcat ) ) { echo ' selected="selected" '; } ?>Local Jams</option> | |
<option value="6"<?php if( (is_array($defcat) && in_array(6, $defcat)) || ( 6 == $defcat ) ) { echo ' selected="selected" '; } ?>Personal Songs</option> | |
<option value="7"<?php if( (is_array($defcat) && in_array(7, $defcat)) || ( 7 == $defcat ) ) { echo ' selected="selected" '; } ?>Tablature</option> | |
</select></p> | |
<p align="right"><input type="submit" value="Publish" tabindex="6" id="submit" name="submit" /></p> | |
<input type="hidden" name="action" value="new_post" /> | |
<?php wp_nonce_field( 'new-post' ); ?> | |
</form> | |
</div> | |
<!--// New Post Form --> | |
if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && ($_POST['action']== 'new_post')) { | |
if (isset ($_POST['title'])) { | |
$title = $_POST['title']; | |
} else { | |
echo 'Please enter a title'; | |
} | |
if (isset ($_POST['performer'])) { | |
$performer = $_POST['title']; | |
} else { | |
echo 'Please enter a performer'; | |
} | |
if (isset ($_POST['composer'])) { | |
$performer = $_POST['description']; | |
} else { | |
echo 'Please enter a composer'; | |
} | |
if (isset ($_POST['performer'])) { | |
$performer = $_POST['description']; | |
} else { | |
echo 'Please enter a performer'; | |
} | |
if (isset ($_POST['tablature'])) { | |
$tablature = $_POST['description']; | |
} else { | |
echo 'Please enter the content'; | |
} | |
$tags = $_POST['post_tags']; | |
$new_post = array( | |
'post_title' => $title, | |
'post_content' => $description, | |
'post_category' => $_POST['cat'], | |
'tags_input' => $tags, | |
'post_status' => 'draft' | |
); | |
wp_insert_post($new_post); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment