Making WordPress.org

Changeset 13635


Ignore:
Timestamp:
05/01/2024 12:38:08 AM ( 3 weeks ago)
Author:
dd32
Message:

Support Forums: Don't apply the <li> improper HTML fixes to block content.

With support forum posts being written with the block editor, invalid HTML is much less likely now.

This tries removing the list item fixes from block posts.

See #20 .
Fixes #7618 .

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support-2024/functions.php

    r13608 r13635  
    one thousand two hundred and one one thousand two hundred and one  */
    one thousand two hundred and two one thousand two hundred and two function wporg_support_wrap_standalone_li_tags_in_ul( $content ) {
      one thousand two hundred and three     remove_filter( current_filter(), 'wporg_support_wrap_standalone_li_tags_in_ul', 50 );
      one thousand two hundred and four
    one thousand two hundred and three one thousand two hundred and five     // No lists? No worries.
    one thousand two hundred and four one thousand two hundred and six     if ( false === stripos( $content, '<li>' ) ) {
     
    one thousand two hundred and fifty-one one thousand two hundred and fifty-three     return $content;
    one thousand two hundred and fifty-two one thousand two hundred and fifty-four }
    one thousand two hundred and fifty-three   add_filter( 'bbp_get_topic_content', 'wporg_support_wrap_standalone_li_tags_in_ul', 50 );
    one thousand two hundred and fifty-four   add_filter( 'bbp_get_reply_content', 'wporg_support_wrap_standalone_li_tags_in_ul', 50 );
      one thousand two hundred and fifty-five
      one thousand two hundred and fifty-six /**
      one thousand two hundred and fifty-seven  * Maybe wrap standalone <li> tags in <ul> tags.
      one thousand two hundred and fifty-eight  * This only wraps non-block-posts.
      one thousand two hundred and fifty-nine  *
      one thousand two hundred and sixty  * @see https://meta.trac.wordpress.org/ticket/7618
      one thousand two hundred and sixty-one  */
      one thousand two hundred and sixty-two function wporg_support_maybe_wrap_standalone_li_tags_in_ul( $content ) {
      one thousand two hundred and sixty-three     // If it's not a block post, we'll need to filter it after all transforms.
      one thousand two hundred and sixty-four     if ( ! has_blocks( $content ) ) {
      one thousand two hundred and sixty-five         add_filter( current_filter(), 'wporg_support_wrap_standalone_li_tags_in_ul', 50 );
      one thousand two hundred and sixty-six     }
      one thousand two hundred and sixty-seven
      one thousand two hundred and sixty-eight     return $content;
      one thousand two hundred and sixty-nine }
      one thousand two hundred and seventy add_filter( 'bbp_get_topic_content', 'wporg_support_maybe_wrap_standalone_li_tags_in_ul', 1 );
      one thousand two hundred and seventy-one add_filter( 'bbp_get_reply_content', 'wporg_support_maybe_wrap_standalone_li_tags_in_ul', 1 );
    one thousand two hundred and fifty-five one thousand two hundred and seventy-two
    one thousand two hundred and fifty-six one thousand two hundred and seventy-three /**
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php

    r13168 r13635  
    eight hundred and sixty-three eight hundred and sixty-three  */
    eight hundred and sixty-four eight hundred and sixty-four function wporg_support_wrap_standalone_li_tags_in_ul( $content ) {
      eight hundred and sixty-five     remove_filter( current_filter(), 'wporg_support_wrap_standalone_li_tags_in_ul', 50 );
      eight hundred and sixty-six
    eight hundred and sixty-five eight hundred and sixty-seven     // No lists? No worries.
    eight hundred and sixty-six eight hundred and sixty-eight     if ( false === stripos( $content, '<li>' ) ) {
     
    nine hundred and thirteen nine hundred and fifteen     return $content;
    nine hundred and fourteen nine hundred and sixteen }
    nine hundred and fifteen   add_filter( 'bbp_get_topic_content', 'wporg_support_wrap_standalone_li_tags_in_ul', 50 );
    nine hundred and sixteen   add_filter( 'bbp_get_reply_content', 'wporg_support_wrap_standalone_li_tags_in_ul', 50 );
      nine hundred and seventeen
      nine hundred and eighteen /**
      nine hundred and nineteen  * Maybe wrap standalone <li> tags in <ul> tags.
      nine hundred and twenty  * This only wraps non-block-posts.
      nine hundred and twenty-one  *
      nine hundred and twenty-two  * @see https://meta.trac.wordpress.org/ticket/7618
      nine hundred and twenty-three  */
      nine hundred and twenty-four function wporg_support_maybe_wrap_standalone_li_tags_in_ul( $content ) {
      nine hundred and twenty-five     // If it's not a block post, we'll need to filter it after all transforms.
      nine hundred and twenty-six     if ( ! has_blocks( $content ) ) {
      nine hundred and twenty-seven         add_filter( current_filter(), 'wporg_support_wrap_standalone_li_tags_in_ul', 50 );
      nine hundred and twenty-eight     }
      nine hundred and twenty-nine
      nine hundred and thirty     return $content;
      nine hundred and thirty-one }
      nine hundred and thirty-two add_filter( 'bbp_get_topic_content', 'wporg_support_maybe_wrap_standalone_li_tags_in_ul', 1 );
      nine hundred and thirty-three add_filter( 'bbp_get_reply_content', 'wporg_support_maybe_wrap_standalone_li_tags_in_ul', 1 );
    nine hundred and seventeen nine hundred and thirty-four
    nine hundred and eighteen nine hundred and thirty-five /**
Note: See TracChangeset for help on using the changeset viewer.