wysiwyg – how to enable on custom shortcodes

I have created a shortcode that displays a table in wordpress using the shortcodes:

function table_data($atts, $content = null)
{

    $defaults = shortcode_atts(array(
        'data' => 'th:data1,td:data2,td:data3'
    ), $atts);

    $table_data = explode(",", esc_attr($defaults['data']));
    $result="<tr>";

    foreach ($table_data as $data) {
        $split = explode(":", $data);
        $result .= '<' . $split[0] . '>' . $split[1] . '</' . $split[0] . '>';
    }

    $result .= '</tr>';
    return $result;
}

add_shortcode('table_data', 'table_data');


function table_anchor($atts, $content = null)
{
    $defaults = shortcode_atts(array(
        'scroll' => 'false'
    ), $atts);

    if (esc_attr($defaults['scroll']) == 'true') {
        $result="<div class="article-tbl-wrap"><table class="article-tbl scrollable"><tbody>";
    } else {
        $result="<div class="article-tbl-wrap"><table class="article-tbl"><tbody>";
    }

    $result .= do_shortcode($content);
    $result .= '</tbody></table></div>';

    return $result;
}

add_shortcode('table_anchor', 'table_anchor');

which is working properly. However, when I put “< br>“Putting the tag so it’s in the page”< br>prints “I did something wrong?

Here’s how I use shortcodes in the editor:

[table_anchor scroll="false"]
[table_data data="th:テスト,th:80.0%,td:testers<br>"]
[table_data data="th:テスト,td:80.0%,td:testers2<br>"]
[/table_anchor]

tell me that”< br>“How to print tags as new lines. Thanks in advance!

Leave a Comment