• roycegracie

    (@roycegracie)


    hi ! i wanted to make users to be able to post a new question undes a category, and that their question will be automaticly posted to that category (without selecting the category in the dropdown box)

    i wanted to share my code:

    1) first i added this to the CATEGORY.PHP file:

    <?php if ( $user_ID ) { ?>
    ask a new question
    	<?php include(ap_get_theme_location('ask.php')); ?>
    <?php } else { ?>
    you must be logged in to ask a question
    <?php } ?>

    this will add the question template to the category page.

    now i went to the file anspress-form.php, here:
    anspress/includes/

    and looked for the div: <div class=”ap-form-group”>
    inside there is the select area, i changed it with:
    <label for=”category”><?php _e(‘Category’, ‘ap’) ?></label>
    <input value="<?php $category = get_queried_object(); echo $category->term_id; ?>" type="hidden" class="form-control" name="category" id="industries">

    i hope this helps anyone…
    i think it would be nice if what i did here was a built in option in that plugin 🙂

    thank you

    https://wordpress.org/plugins/anspress/

  • The topic ‘i wish to allow users to ask questions inside a certien category’ is closed to new replies.