• I have setup a wordpress site to act as a questions and answers site. Everything is going great so far except i am stumped on how to get the frontend posts to allow multiple categories. I can easily go into backend to add categories to each post but point of site is to allow visitors to post their question and assign it to a subcategory of two seperate parent categories. They should be able to post to either one or both. The site can be viewed at https://demo.brightideainteractive.com/helpmewritethebook/

    I am using the quickpress widget / plugin to get the post box in the popup and now i need the code to allow it to post to multiple categories.

    If you sign up for an account and then click on ask question a popup with post fields opens with two category dropdowns. You can fill everything out but nothing actually gets posted into a category. Just gets posted to uncategorized. Im pretty new to php so im a bit lost. Just trying to work my way through this. Any help would be greatly appreciated. Here is my code so far:

    <?php
    $user			= get_userdata( $current_user->ID );
    ?>
    
    <h2>Ask Your Question:</h2>
    <div id="postbox" style=" padding: 15px; margin: 5px 0px; " >
    	<form id="new_post" name="new_post" method="post" action="<?php bloginfo( 'url' ); ?>/">
    		<input type="hidden" name="action" value="post" />
    		<?php wp_nonce_field( 'new-post' ); ?>
    		<label for="title">Question Title:</label>
    		<br />
    		<input type="text" name="title" id="title" style="width:95%; height: 25px; border: 1px solid #99afbc; margin: 5px 0 10px 0;" />
    		<br />
    		<label for="posttext">Question Description:</label>
    		<br />
    		<textarea name="posttext" id="posttext" rows="3" style="width:95%; height: 80px; border: 1px solid #99afbc; margin: 5px 0 10px 0;" ></textarea>
    	  <br />
    		 <label>Select a Question Category (Choose an option from one or both):<span class="asterixRequired">*</span></label><br /><br />
    
    	<select name="question_category" size='1'>
                  <option selected="selected" value="0">-Select A Cateogry -</option>
                  <?php
                  foreach ( get_categories('child_of=6&orderby=name&hide_empty=0&exclude=1') as $category) { ?>
                  <option value="<?php echo $category->cat_ID; ?>"><?php echo $category->cat_name; ?></option>
                  <?php } ?>
              </select>&nbsp;&nbsp;  And / Or &nbsp;&nbsp;
              <select name="question_category" size='1'>
                  <option selected="selected" value="0">-Select An Industry Issue-</option>
                  <?php
                  foreach ( get_categories('child_of=3&orderby=name&hide_empty=0&exclude=1') as $category) { ?>
                  <option value="<?php echo $category->cat_ID; ?>"><?php echo $category->cat_name; ?></option>
                  <?php } ?>
              </select>
              <br />
    		<br />
    
                            <input type="hidden" name="question_post" value="1" />
                            <div class="divider"></div>
                            <div class="addQuestion"><input type="image" name="submit_question" id="submit_question" src="<?php bloginfo('template_url'); ?>/images/add-question-btn.png" value="submit" /></div>
                        </form>
    </div> <!-- // postbox -->
  • The topic ‘Multicategory posts from frontend’ is closed to new replies.