[Plugin: Q and A – FAQ Plugin] Filter Request
-
This is a great plugin and I have used it on many sites. One customer wanted me to put #’s in front of each question and a permalink at the end of the answer. So instead of REALLY hacking the plugin, I’ve hacked it the right way and was wondering if you would consider adding some filters to the plugin so this would be officially supported. This is what I did:
$qa_shortcode .= '<div class="faq-title"><a href="'.get_bloginfo('wpurl').'?qa_faqs='.$postslug.'">'.apply_filters("qa_faqs_title",$title).'</a></div>'; $qa_shortcode .= '<div class="faq-answer">'.apply_filters("qa_faqs_answer",$answer, $postslug).'</div>';
Also, is there a reason that it’s
?qa_faqs=
instead of the prettier/faq/
?Thanks!
EDIT: and for interest, here’s my somewhat hackier code that I put in the theme’s
functions.php
to tie in to the new filters.global $faq_count; $faq_count = 0; add_filter('qa_faqs_title','myfaqtitle'); function myfaqtitle($str) { global $faq_count; $faq_count++; return $faq_count . ': ' . $str; } add_filter('qa_faqs_answer','myfaqanswer', 10, 2); function myfaqanswer($str, $postslug) { return $str . '<p class="faq-permalink"><a href="' . get_bloginfo('url').'/faq/'.$postslug . '">(permalink)</a></p>'; }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘[Plugin: Q and A – FAQ Plugin] Filter Request’ is closed to new replies.