Support » Plugin: Accordion Shortcodes » unnecessary p tag

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Phil Buchanan

    (@philbuchanan)

    The first thing I would suggest trying it putting the opening <table> tag on the same line as the opening [accordion-item] shortcode. You can do this on the Text (HTML) tab of the editor. WordPress likes to automatically add <p> tags where it can.

    Thanks, Phil. I’ve already tried that, but no luck. It’s not a big deal so I can leave it as it is. Thanks!

    Auto stripping of br and p tags in the accordion group, while sustaining them in each accordion’s content pane, can be accomplished by editing the source lines in both (shortcodes):

    
    public function accordion_shortcode($atts, $content = null) {
        ...
        $alter = array(
            '<p>'    => '',
            '</p>'   => '',
            '<br />' => ''
        );
        $content = strtr( $content, $alter );
    
        return sprintf('<%2$s id="%3$s" class="accordion no-js%4$s" role="tablist" aria-multiselectable="true">%1$s</%2$s>',...
    

    and

     
    public function accordion_item_shortcode($atts, $content = null) {
        ...
            $content = wpautop($content);
    
    	$accordion_content = sprintf('<%1$s id="%3$s" class="accordion-content" role="tabpanel" aria-labelledby="%4$s" aria-hidden="true">%2$s</%1$s>',...
    

    I’d submit this as a pull request but cannot find the git repository for this plugin.

    I’d like to see this added as a feature to the plugin as well.

    Some of my accordions start out with an unordered list, but the output content is a blank <p></p> at the beginning and end of each accordion block.

    • This reply was modified 2 years, 1 month ago by jsites.
    • This reply was modified 2 years, 1 month ago by jsites.
    • This reply was modified 2 years, 1 month ago by jsites.
    sohopros

    (@sohopros)

    Hi,

    We getting w3 validation error because of <p> tag:
    Example:
    “Error: No p element in scope but a p end tag seen.”

    Can you make changes on core code so we do not have this issue?

    Thanks,
    Sandra

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘unnecessary p tag’ is closed to new replies.