4.1.1 title solved problem

Solved6.89K viewsUpdatestitle
0

AnsPress 4.1.0 title solved problem

Unfortunately. It did not work. :/ Why do not you answer me?

Question is closed for new answers.
selected answer
0

Hello,

As I can see source code, [[solved]] is only applied to browser title not single question title (I am not sure about reason, may be its not required for SEO anymore!). You can add below code to your theme’s functions.php to fix it:

function my_ap_the_title( $title, $ID ) {
  $post = ap_get_post( $ID );
  if ( 'question' === $post->post_type && ! empty( ap_selected_answer( $ID ) ) ) {
    return $title . ' [solved]';
  }
  return $title;
}
add_filter( 'the_title', 'my_ap_the_title', 10, 2 );
selected as best answer

It’s affecting the whole site. This is important for me.

I don’t see anything wrong in this code. You just want to show in single question page?

Yeah. you see the answered questions

I did not understand. Please write sample code? 🙂

You are viewing 1 out of 4 answers, click here to view all answers.