Q and A FAQ and Knowledge Base for WordPress
[Plugin: Q and A - FAQ Plugin] link to faq question with answer displayed inline on shortcode page? (5 posts)

  1. EFDisaster
    Posted 4 years ago #

    I guess I don't quite understand the jQuery that's being used, but I was wondering if there was a way to link to a Page where I've included the qa shortcode, displaying all the FAQ entries, but directly to a certain question, with the answer already visible.


  2. Dalton Rooney
    Plugin Author

    Posted 4 years ago #

    That would require some modifications to the plugin to support it. I will add it to the list of ideas for the future, thanks!


  3. EFDisaster
    Posted 4 years ago #

    until this is implemented, or I muster up the motivation to solve it myself, could you tell me what template is being used to display the single questions... and if I can remove the comments section and maybe add a link to the page I made with the shortcode to it.

  4. Dalton Rooney
    Plugin Author

    Posted 4 years ago #

    The default template for single custom post types is just single.php. You can create a specific template for FAQs by duplicating single.php and renaming it single-qa_faqs.php. Then you can edit that file all you want.


  5. Copernicus
    Posted 3 years ago #

    I know that this is a bit old of a thread, but I had a similar need to be able to link directly to a specific FAQ question/answer combo within a 'Q and A' page generated by the shortcode. I came up with the following solution.

    Linking to Specific Questions & Answers

    Within the file q-and-a.php, I edited around line 125 FROM
    $qa_shortcode .= '<div class="faq-title"><a href="'.get_bloginfo('wpurl').'?qa_faqs='.$postslug.'">'.$title.'</a></div>';


    $qa_shortcode .= '<a id="'.$postslug.'"></a><div class="faq-title"><a href="'.get_bloginfo('wpurl').'?qa_faqs='.$postslug.'">'.$title.'</a></div>';

    The primary change being the addition of a named anchor with the code snippet of <a id="'.$postslug.'"></a>

    This creates a named anchor just before the "faq-title" div and will give that named anchor an ID of whatever the FAQ question's slug is.

    Forcing Display/Visibility of the Answers

    To remove the need to click a question to show/hide its answer, you can use the following CSS. Keep in mind, however,that this applies to ALL answers (so they will all be showing). If you create a more specific class/ID restriction, you could limit that side effect. But, that particular answer will still show all the time -- this isn't a show/hide event based on linking (which would be ideal).

    div.faq-answer { display: block !important; }

    Hope this helps!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic