Im wondering how to tag location to the anspress questions. Ideally, I need a map on ASK page where users can select their location. This location tag will be later used as a filtering option.
Let me know hoe this can be achieved.
Ashvam
What are the steps to install buddypress?
Hi Rahul,
the following code would use post id as new question slug when user creates a new question.
It works well. However, it doesn’t work when the user edit an question.
when user edit an question, somehow the answer title would become the post slug, overwriting the slug id that was there before.
all i wanted is the use post id when user create a new question, or even edit an existing question. is there any action hook other than ap_after_new_question ?
thanks.
add_action( ‘ap_after_new_question’, ‘using_id_as_slug’, 10, 2 );
 function using_id_as_slug($post_id, $post){
 global $post_type;
 remove_action(‘ap_after_new_question’, ‘using_id_as_slug’ );
 wp_update_post(array(‘ID’ => $post_id, ‘post_name’ => ‘q’ . $post_id ));
 add_action(‘ap_after_new_question’, ‘using_id_as_slug’ );
 }
Edit —
the following solution works for me. of cause, you can refactor to remove redundant code.
add_action( 'ap_after_new_question', 'using_id_as_slug', 10, 2 );
add_action('ap_after_update_question', 'using_id_as_slugB', 10, 2);
function using_id_as_slug($post_id, $post){
  global $post_type;
    if (wp_is_post_revision($post_id))
      return false;
    remove_action('ap_after_new_question', 'using_id_as_slug' );
    wp_update_post(array('ID' => $post_id, 'post_name' => 'q' . $post_id ));
    add_action('ap_after_new_question', 'using_id_as_slug' );
}
function using_id_as_slugB($post_id, $post){
  global $post_type;
    if (wp_is_post_revision($post_id))
      return false;
    remove_action('ap_after_update_question', 'using_id_as_slugB' );
    wp_update_post(array('ID' => $post_id, 'post_name' => 'q' . $post_id ));
    add_action('ap_after_update_question', 'using_id_as_slugB' );
}
as you can see feom the screen shot, editor shows html code when user try to modify answer?
is that an expected behavior? it looks strange to me, as user might not have html knowledge, they might be confused what those p tags are.
Hi!
I’m including thumbnails from the questions in the users page, like this:

But in some pages I can’t take the ID from the question to put the image, like in Reputation page. I tried some functions, but I can only get the answer ID.
For example, in theme/default/user/reputation-content.php
<?php /** * Reputation loop item template * */ ?> <?php //Do not change id attribute ?> <div id="ap-reputation-<?php ap_reputation_get_the_id(); ?>" class="ap-reputation-item <?php ap_reputation_get_the_class(); ?>"> <?php $questionID = FUNCTION_TO_GET_THE_QUESTION_ID; echo '<div class="float: left; containerIMG" style="border: solid 1px white;outline: solid 1px;margin-right: 10px;width: 54px;float: left;height: 54px;">'. imgBackground( 52, $questionID ).' </div>'; ?> <span class="point"><?php ap_reputation_get_the_reputation() ?></span> <div class="no-overflow"> <span class="time"><?php ap_reputation_get_the_date(); ?></span> <span class="info"><?php ap_reputation_get_the_info(); ?></span> </div> </div>
What I should use in $questionID ?
Thanks.
No sharing plugin till now is showing the question title on facebook
Is there a work around for this issue??
Hello. I want to show recent questions of Anspress in a page by shortcode. How can I do that?..
Hi there,
here is another question, hope this has response ; )
How can I show in a widget area ‘how many Questions’ have been published?
Thank you
I can not create sign up or login page with an anspress. When users want to sign up, register link direct this users to wp-login page. How can I fix this issue?