Hey Griff!
I’d be happy to take a look at your code. What is the best way to do so?
Best,
Richard
Hey Griff!
Just touching base on this one.
If I don’t hear back I’ll close this out – I think we’re going to build this in ourselves.
Best,
Richard
Sorry I have been busy building a WordPress site. Custom healthcare EMR deployments can be time consuming. Below is a link to the zip file so you can see the code. It is the whole plugin, so all the edited files are inside.
http://chasemg.com/files/easy-faqs.zip
Thanks Griff!
No need to apologize. I will review the zip!
Best,
Richard
I forgot to add this code into the file because my site was coded a little different.
function scrollToAnchor(aid){
var aTag = $("#"+ aid +"");
var wWidth = $(window).width();
var wHeight = $(window).height();
topMargin = wHeight/2 - aTag.height()/2;
$('html,body').animate({scrollTop: aTag.offset().top - topMargin},'slow');
}
$(".scroll_to").click(function() {
var scrollId = $(this).attr('id');
scrollToAnchor('scroll_to_'+scrollId);
});
That just needs to be included for the smooth scroll on the quick links. I had this built into another file and forgot it needs to be in this as well.
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
Quick followup: the above code has a few errors that I’ve noticed after the fact, including leaving trailing divs open and producing invalid HTML (you can’t have divs wrapping li’s inside of lists.)