• Hi,

    The way I have the plugin setup is: Instead of using the toggle menu to open the answer for each FAQ, the user clicks on the link of the question and is then taken to a new page where the answer is displayed.

    Is there a way to create a list of related FAQ posts at the bottom of this page? Ideally the list should be below the answer and should be a list of links to FAQ posts within the same category.

    Thanks

    Sandy

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Sandy,

    There is no currently no option for this. The single post page for FAQs will, by default, make use of your theme’s single.php file. As such, you could try using WordPress’s built-in do_shortcode() method (https://developer.wordpress.org/reference/functions/do_shortcode) to add an FAQ shortcode right into your template. In this shortcode you could use shortcode attributes to display FAQs from specific categories. The FAQ shortcode accepts two attributes, “include_category” and “exclude_category”. Both take a comma-separated list of FAQ category slugs. For example, to include only FAQs about the Category “Foundation” (which has a slug “foundation”), you could try something like:

    
    echo do_shortcode('[ultimate-faqs include_category="foundation"]');
    
    Thread Starter sandytaylor443

    (@sandytaylor443)

    Hi! Thanks for the reply. This seems to be a good approach.

    My concern is: I only want to show the “related faqs” list on faq pages and not on my posts and pages. Will my posts and pages be affected if I used the code above in my template?

    Thanks a lot for your help

    Hi Sandy,

    Not if you duplicate your single.php file and name the new copy “single-ufaq.php”, and then make the changes to this file (following the guidelines here: https://codex.wordpress.org/Post_Type_Templates). This way the single post pages for the ufaq post type will use “single-ufaq.php” and all the rest of your post types will use their respective templates or “single.php”.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Display Related FAQ Posts’ is closed to new replies.