Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample FAQ view file
<?php
$args = array(
'post_type' => 'faq',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'faq_category',
'field' => 'id',
'terms' => explode(',', $attrs['include_categories']),
),
),
);
$query = new WP_Query($args);
while ($query->have_posts()) {
$query->the_post();
echo sprintf("<h6 class='%s'>%s</h6>", $attrs['question_class'], get_the_title());
echo sprintf("<p class='%s'>%s</p>", $attrs['answer_class'], apply_filters('the_content', get_the_content()));
}
wp_reset_query();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.