/ Published in: jQuery
This is a bit of jQuery within a PHP function that you can dump into your Thesis custom_functions.php file to hide comments upon page load and add a link to show them.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function custom_jquery() { ?> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $("div#comments").hide(); $("p#show_comments > a").click(function(){ $("div#comments").show(); }); }); </script> <?php } add_action('wp_head', 'custom_jquery'); function show_comments() { if (is_single()) { echo '<p id="show_comments"><a href="#comments">Show Comments</a></p>'; } } add_action('thesis_hook_after_post', 'show_comments', 99);
URL: http://diythemes.com/forums/thesis-customization/3475-show-hide-comments.html#post17870