### Callback: onSlideBefore Example Source: https://github.com/wp-plugins/wpdiscuz/blob/master/bxslider/readme.md This callback executes just before a slide transition occurs. It provides the destination slide element, the previous slide index, and the new slide index. ```javascript options: function($slideElement, oldIndex, newIndex){ // your code here } ``` -------------------------------- ### Callback: onSliderLoad Example Source: https://github.com/wp-plugins/wpdiscuz/blob/master/bxslider/readme.md This callback executes once the slider has finished loading. It receives the index of the current slide as an argument. ```javascript options: function(currentIndex){ // your code here } ``` -------------------------------- ### Utility Functions with WC_Helper Source: https://context7.com/wp-plugins/wpdiscuz/llms.txt Utilize shared utility methods for date differences, checking comment status, resolving comment ancestors, making text clickable, getting client IP, sorting comments, and retrieving user avatars. ```php global $wc_core; $helper = $wc_core->wc_helper; // --- Human-readable relative date (e.g. "2 hours 15 minutes ago") --- $relative = $helper->dateDiff(time(), strtotime($comment->comment_date_gmt), 2); // --- Check if a comment was posted today --- $today = WC_Helper::is_posted_today($comment); // bool // --- Check if comment is still within editable window --- $editable = $helper->is_comment_editable($comment); // bool // --- Resolve root ancestor of a comment (recursively) --- $root = WC_Helper::get_comment_root_id($comment_id); // --- Convert plain text URLs/emails/images to HTML links --- $html = $helper->make_clickable('Visit https://example.com or email me@example.com'); // --- Get real client IP (proxy-aware) --- $ip = WC_Helper::get_real_ip_addr(); // --- Sort parent comments ascending by ID --- $sorted = $helper->wc_sort_parent_comments($wc_parent_comments); // array of WP_Comment // --- Get user avatar (with social login plugin support) --- $avatar_html = $helper->get_comment_author_avatar($comment); // returns get_avatar() HTML (48px) ``` -------------------------------- ### Handle Subscription Confirmation and Unsubscribe URLs Source: https://context7.com/wp-plugins/wpdiscuz/llms.txt This code snippet from form.php processes GET parameters to confirm subscriptions or unsubscribe users. It requires the wc_core object to be available. ```php if (isset($_GET['wpdiscuzSubscribeID']) && isset($_GET['key'])) { $wc_core->wc_unsubscribe($_GET['wpdiscuzSubscribeID'], $_GET['key']); // Shows: "You've successfully unsubscribed." } if (isset($_GET['wpdiscuzConfirmID']) && isset($_GET['wpdiscuzConfirmKey'])) { $wc_core->wc_db_helper->wc_notification_confirm( $_GET['wpdiscuzConfirmID'], $_GET['wpdiscuzConfirmKey'] ); // Shows: "You've successfully confirmed your subscription." } ``` -------------------------------- ### Start Auto Play Source: https://github.com/wp-plugins/wpdiscuz/blob/master/bxslider/readme.md Initiates the automatic sliding of the carousel. An optional argument `false` can be passed to prevent auto controls from updating. ```javascript slider = $(".bxslider").bxSlider(); slider.startAuto(); ``` -------------------------------- ### Render Comment HTML with WC_Comment_Template_Builder Source: https://context7.com/wp-plugins/wpdiscuz/llms.txt Use get_comment_template() to build the complete HTML for a single comment. This includes avatar, author info, content, voting, reply form, and sharing options. It also provides methods to get author names and unique DOM identifiers. ```php global $wc_core; $builder = $wc_core->comment_tpl_builder; // Render a single comment $comment = get_comment(157); $depth = 1; $html = $builder->get_comment_template($comment, null, $depth); // $html is a complete