philbuchanan / Accordion-Shortcodes

A WordPress plugin that adds a few shortcodes to allow for accordion dropdowns.
https://wordpress.org/plugins/accordion-shortcodes/
16 stars 10 forks source link

To remove the <br> tag #33

Closed moloimaga12 closed 9 years ago

moloimaga12 commented 9 years ago

can you give me a hint on how i can remove the

.

thank you

philbuchanan commented 9 years ago

This is unfortunately not an issue I can address in the plugin. It has to do with wpautop in WordPress. WordPress tends to want to wrap paragraph and break tags around shortcodes. You can get around this by adding this code to your themes functions.php file:

/**
 * Fixes empty <p> and <br> tags showing before and after shortcodes in the
 * output content.
 */
function pb_the_content_shortcode_fix($content) {
    $array = array(
        '<p>['    => '[',
        ']</p>'   => ']',
        ']<br />' => ']',
        ']<br>'   => ']'
    );
    $content = strtr($content, $array);

    return $content;
}
add_filter('the_content', 'pb_the_content_shortcode_fix');
moloimaga12 commented 9 years ago

thanks alot sir...i will try what you suggest....

God bless

On Wed, Mar 18, 2015 at 11:06 AM, Phil Buchanan notifications@github.com wrote:

Closed #33 https://github.com/philbuchanan/Accordion-Shortcodes/issues/33.

— Reply to this email directly or view it on GitHub https://github.com/philbuchanan/Accordion-Shortcodes/issues/33#event-257660190 .

Romulo G. Maga Jr. (02) 781-1804 / +639058707678