Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //initialize pods
- $category = SOMEHOW REFERENCE WOOCOMMERCE PRODUCT CATEGORY TAXONOMY
- $questions = new Pod('ask_washroom_guy');
- //Get categories sorted by name
- $category->findRecords('t.name',-1);
- while($category->fetchRecord()){
- $catName = $category->get_field('name');
- $catID = $category->get_field('id');
- ?>
- //output the category name as a header
- <h3 id="<?php echo $catID; ?>" class="cat"><?php echo $catName; ?></h3>
- <?php
- //Query for all FAQ questions belonging to this category slug
- //findRecords([sort by display_order], [return all results],
- //[where category matches])
- $questions->findRecords('display_order DESC', -1, 'category.slug LIKE "'. $catSlug .'"');
- while($questions->fetchRecord()){
- $question_name = $questions->get_field('name');
- $question_question = $questions->get_field('question');
- $question_answer = $questions->get_field('answer');
- $question_display_order = $questions->get_field('display_order');
- $question_slug = $questions->get_field('slug');
- ?>
- // Output the questions in this format
- <div class="question">
- <h4><?php echo $question_question; ?></h4>
- <p><?php echo $question_answer; ?></p>
- </div>
- <?php
- }
- ?>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment