Created
April 26, 2017 05:07
-
-
Save mrkdevelopment/39cde0ca57b9e512dcef94ef9b3b5304 to your computer and use it in GitHub Desktop.
Sample FAQ view file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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