Title: Shortcode DIV new line
Last modified: September 21, 2023

---

# Shortcode DIV new line

 *  Resolved [lewisburgess79](https://wordpress.org/support/users/lewisburgess79/)
 * (@lewisburgess79)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/shortcode-div-new-line/)
 * I’m not sure if this is Content Control or something to do with my theme, but
   each time I use the ‘content_control’ shortcode, it creates a DIV that means 
   each item is on a new line, which is undesirable. It didn’t used to do this with
   older versions.
 * These are the DIV classes that are being applied, which I think are all content
   control ones only:
 * class=”content-control-container jp-cc content-control-accessible jp-cc-accessible”
 * Is someone able suggest what PHP snippet or CSS code I can use to prevent content
   control from creating a DIV for each item (which then creates a new line as above)?
 * Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/shortcode-div-new-line/#post-17070194)
 * [@lewisburgess79](https://wordpress.org/support/users/lewisburgess79/) – Sorry
   to hear that. Can you give me an idea of how you are using them? I ask because
   you mentioned “making new lines” was undesirable, I’m assuming you are using 
   them inline with other text surrounding them?
 * I just want to be sure I’m solving for the right issue.
 * In any case I just checked the old and new and the only difference appears to
   be that we added an extra class. No new div, the div was always there.
 * So unless you have CSS on the page that targets those classes, or maybe some 
   new theme CSS that makes all `div` render as blocks, nothing should have changed:
    - [Old](https://github.com/code-atlantic/content-control/blob/v1.1.10/classes/Shortcodes.php#L48-L54)
    - [New](https://github.com/code-atlantic/content-control/blob/master/classes/Controllers/Shortcodes.php#L82-L92)
 *  Thread Starter [lewisburgess79](https://wordpress.org/support/users/lewisburgess79/)
 * (@lewisburgess79)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/shortcode-div-new-line/#post-17071742)
 * Hi,
 * I’ve linked to some screenshots which will hopefully show what’s happening (this
   is an Intranet site so isn’t accessible without a login). 
   End user view: [https://ibb.co/s6JXvgW](https://ibb.co/s6JXvgW)
   Code view: [https://ibb.co/D9066YL](https://ibb.co/D9066YL)Nimble editor visual
   view: [https://ibb.co/L13jKVz](https://ibb.co/L13jKVz) (note I’ve turned off “
   Automatically convert text into paragraph”)End user browser developer tools code
   of the area: [https://ibb.co/5TRd1DK](https://ibb.co/5TRd1DK)
 * In the End user view, you will see each item on a new line. They should be side-
   by-side without a paragraph/new line from a DIV.
   Not sure if this is the theme
   or editor though?Thanks for your help 🙂Lewis
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/shortcode-div-new-line/#post-17073023)
 * [@lewisburgess79](https://wordpress.org/support/users/lewisburgess79/) – Curious,
   have you tried downgrading to v1.10 again? Not as a solution, but if it happens
   with that version too I’d have to assume it was in fact coming from theme or 
   something else.
   Honestly I can’t see how adding those 2 classes in the new version
   would change things, unless something in your theme also used those same classes
   before we did so. Otherwise if you also updated theme or other plugins recently
   that might be a good place to check as well.That said, in your editor you wrap
   them with <p>, change that to a <div> and the html should be valid. Currently
   <div> can’t be inside a <p>, but our shortcode always used divs so I don’t think
   that was the only issue.
 * In the short term simple fix might just be some CSS.
 *     ```wp-block-code
       .some-custom-parent-class .content-control-accessible {    display: inline; // you could try inline-block as well.}
       ```
   
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/shortcode-div-new-line/#post-17074725)
 * [@lewisburgess79](https://wordpress.org/support/users/lewisburgess79/) – v2.0.9
   had some changes to the custom message, both in how it is saved and rendered.
   Might be worth seeing if that helps resolve any issues.
 * Let me know.
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/shortcode-div-new-line/#post-17084460)
 * [@lewisburgess79](https://wordpress.org/support/users/lewisburgess79/) – If your
   still having issues feel free to mark this as unresolved again.
 * If not please take a moment to [rate & review](https://wordpress.org/support/plugin/content-control/reviews/?rate=5#rate-response)
   the plugin and or support to spread the word.
 *  Thread Starter [lewisburgess79](https://wordpress.org/support/users/lewisburgess79/)
 * (@lewisburgess79)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/shortcode-div-new-line/#post-17084979)
 * Sorry for the delay. I updated the plugin but saw no change in behaviour 🙁
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/shortcode-div-new-line/#post-17091055)
 * [@lewisburgess79](https://wordpress.org/support/users/lewisburgess79/) – Ok so
   I just set up a test using the following simple but effective blob of shortcode:
 *     ```wp-block-code
       [content_control logged_out=1]Login[/content_control][content_control]Logout[/content_control][content_control logged_out=1]Login[/content_control][content_control]Logout[/content_control][content_control logged_out=1]Login[/content_control][content_control]Logout[/content_control][content_control logged_out=1]Login[/content_control][content_control]Logout[/content_control]
       ```
   
 * This results in 
   LogoutLogoutLogoutLogoutWhen I expect LogoutLogoutLogoutLogout
   etc.
 * **That said I also tested this same code on v1.10.2, with the exact same results.**
 * So it wasn’t different before, but I do see the need for this to work as intended.
   
   We might have to add an `inline` parameter to it.
 * I do think you can get there today using the following.
 *     ```wp-block-code
       [content_control logged_out=1 class="inline"]Content[/content_control]
       ```
   
 * Then add some CSS to your site of
 *     ```wp-block-code
       .content-control-container.inline { display: inline; }
       ```
   
 * I have added this to our issue tracker. Gonna mark this resolved for now as its
   not a new bug and we need to think out a long term solution.
 * Please take a moment to [rate & review](https://wordpress.org/support/plugin/content-control/reviews/?rate=5#rate-response)
   the plugin and or support to spread the word.
    -  This reply was modified 2 years, 8 months ago by [Daniel Iser](https://wordpress.org/support/users/danieliser/).

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Shortcode DIV new line’ is closed to new replies.

 * ![](https://ps.w.org/content-control/assets/icon-256x256.gif?rev=2968535)
 * [Content Control - The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More](https://wordpress.org/plugins/content-control/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/content-control/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/content-control/)
 * [Active Topics](https://wordpress.org/support/plugin/content-control/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/content-control/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/content-control/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/shortcode-div-new-line/#post-17091055)
 * Status: resolved