searsandrew / centreforge

WordPress Theme designed for freelance developers with a Bootstrap Base, intended to use child themes for Customer site
0 stars 0 forks source link

Adding paragraphs in TinyMCE throws off Bootstrap shortcode #9

Open searsandrew opened 8 years ago

searsandrew commented 8 years ago

Shortcode for creating the Bootstrap columns does not work as expected since WordPress inserts blank paragraph tags.

mread1208 commented 8 years ago

Took a quick look at this, right now, I'm thinking we may only be able to do this if we build a nested shortcode for the bootstrap columns. Make's it a little more confusing but it might be better in the long run.

Maybe we wrap everything in a [bootstrap-columns] shortcode, and nest a [bootstrap-column] inside of it?

[bootstrap-columns]     [bootstrap-column col="6" size="xs" row="first"]Column Content Here[/bootstrap-column]     [bootstrap-column col="6" size="xs" row="first"]Column Content Here[/bootstrap-column] [/bootstrap-columns]

mread1208 commented 8 years ago

There's a pretty good plugin out there that includes a lot of Bootstrap's functionality as shortcodes. I'm going to "borrow" a few of these and try to overhaul our columns. Bootstrap 3 Shortcodes

mread1208 commented 8 years ago

This looks to be part of your answer:

function bs_fix_shortcodes($content){   
    $array = array (
        '<p>[' => '[', 
        ']</p>' => ']', 
        ']<br />' => ']',
        ']<br>' => ']'
    );

    $content = strtr($content, $array);
    return $content;
}

add_filter('the_content', 'bs_fix_shortcodes');
mread1208 commented 8 years ago

I believe I have addressed this issue in the dev branch. I changed up the shortcode so that the columns are nested inside of a row:

[bs-row]
    [bs-column md="6"]
    ...
    [/bs-column]
    [bs-column md="6"]
    ...
    [/bs-column]
[/bs-row]

\ Just to note, I kept the old shortcode, [bs-columns] in there for backwards compatability. Let me know if we can remove that short code or not.

searsandrew commented 8 years ago

Ok, one thought on this, we need an easy way for customers to know to use the [bs-row] shortcode.

mread1208 commented 8 years ago

Take a look at the short code in development right now. If you click on the "Bootstrap Columns" short code, a window show's listing exactly how to use the short code including all of the parameters and the option to "add the basic example" into the editor. Maybe we need to explain it better in that modal window?