Changeset 9438 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
- Timestamp:
- 01/30/2020 02:15:05 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
r9277 r9438 591 591 add_filter( 'bbp_get_topic_edit_url', 'wporg_support_fix_pending_posts_reply_url', 10, 2 ); 592 592 add_filter( 'bbp_get_reply_edit_url', 'wporg_support_fix_pending_posts_reply_url', 10, 2 ); 593 594 /** 595 * Prevent standalone <li> tags from breaking the theme layout. 596 * 597 * If a <li> tag is not preceded by <ul> or <ol>, prepend it with <ul> 598 * and let force_balance_tags() do the rest. 599 * 600 * @see https://meta.trac.wordpress.org/ticket/20 601 * @see https://bbpress.trac.wordpress.org/ticket/2357 602 * 603 * @param string $content Topic or reply content. 604 * @return string Filtered content. 605 */ 606 function wporg_support_wrap_standalone_li_tags_in_ul( $content ) { 607 if ( false !== strpos( $content, '<li>' ) ) { 608 $content = preg_replace( '#(?<!<ul>\s|<ol>\s)<li>#', '<ul><li>', $content ); 609 $content = force_balance_tags( $content ); 610 } 611 612 return $content; 613 } 614 add_filter( 'bbp_get_topic_content', 'wporg_support_wrap_standalone_li_tags_in_ul', 50 ); 615 add_filter( 'bbp_get_reply_content', 'wporg_support_wrap_standalone_li_tags_in_ul', 50 ); 593 616 594 617 /**
Note: See TracChangeset
for help on using the changeset viewer.