Hey Griff!
Thanks for sharing the code. We were able to implement a version of what you have into our plugin and think it fits nicely.
I notice it looks like some of the changes, such as the fonts in the CSS, are specific to your site. Those changes weren’t brought over, and as such you probably want to stay isolated on the version you are currently using.
However, we were able to clean up your function a little bit so I wanted to share it with you:
//load faqs into an array
$loop = new WP_Query(array( 'post_type' => 'faq','posts_per_page' => $count, 'orderby' => $orderby, 'order' => $order, 'easy-faq-category' => $category));
$i = 0;
$r = $loop->post_count;
$divCount = intval($r/5);
$divWidth = floor(100/$divCount);
echo "<div class='quick-links'>Quick Links</div>";
echo "<div class='faq-questions'>";
echo "<ol>";
echo '<div class="easy-faq-questions" style="width: '.$divWidth.'%;">';
while($loop->have_posts()) : $loop->the_post();
$postid = get_the_ID();
if($i%5 == 0 && $i != 0) {
echo "</div>";
echo '<div class="easy-faq-questions" style="width: '.$divWidth.'%;">';
}
echo '<li class="faq_scroll" id="'.$postid.'"><a href="#easy-faq-' . $postid . '">' . get_the_title($postid) . '</a></li>';
$i ++;
endwhile;
echo "</ol>";
echo "</div>";
Thanks for using our plugin!
Best,
Richard