Output linebreaks

3 posts in this topic

In a custom section I have a textarea option. When I enter some text in the textarea and do some linebreaks, I see them in the DMS editor, but they are gone on the output.


How do I keep these linebreaks on the output? I have now:

function section_template() {
    printf( '
            <div class="row">
                <div class="span4">%1$s</div>
                <div class="span6"><p>%2$s</p></div>
            $this->opt( 'my_text' ), // This my textarea 

Share this post

Link to post
Share on other sites



Can you add your whole custom sections code (full section.php file) to your reply, so I can try myself please.


Also, try viewing our developer docs which has information on how to add text areas etc. - http://docs.pagelines.com/developer/dms-option-engine


Like so:


$opts[] = array(
            'key'           => 'some_key',
            'type'          => 'textarea', 

Share this post

Link to post
Share on other sites

Here it is:

Section: Sub Header
Author: Blue Cloud
Author URI: http://www.bluecloudcompany.com
Description: Een subheader met daarin een menu en een tekstblok
Version: 1.0.0
Class Name: EGS_SubHeader
Filter: Component

class EGS_SubHeader extends PageLinesSection {

    function section_persistent() {

        // Put code that should always be loaded here.
        $url = $this->base_url; // the base url of the section
        $dir = $this->base_dir; // the base directory of the section


    function section_opts() {

        $opts = array(
            array (
                'key'           => 'subheader_menu',
                'type'          => 'select_menu',
                'title'         => __('Sub Menu', 'erfgoedspoor'),
                'label'			=> __( 'Selecteer menu', 'erfgoedspoor' )
				'key'			=> 'subheader_title',
				'type'			=> 'text',
                'title'         => __( 'Titel', 'erfgoedspoor'),
				'label'			=> __( 'Titel in de Sub Header', 'erfgoedspoor' ),
				'key'			=> 'subheader_text',
				'type'			=> 'textarea',
                'title'         => __( 'Tekstblok', 'erfgoedspoor'),
				'label'			=> __( 'Tekst in de Sub Header', 'erfgoedspoor' ),
        return $opts;


    function section_styles() {


    function section_head(){

        // This will out put in between your sites <head> tags.
        // For example, adding javascript:
            jQuery(window).ready(function() {
                // Javascript could go here.


    function section_template() {

        printf( '
            <div class="row">
                <div class="span4">%3$s</div>
                <div class="span6 subheader-text"><h5>%2$s</h5><p>%1$s</p></div>
            $this->opt( 'subheader_text' ),
            $this->opt( 'subheader_title' ),


     * Build the menu
     * @return string
    private function build_menu( ) {

        $menu = $this->opt( 'subheader_menu');
        $menu_list = '';
        $menu_items = wp_get_nav_menu_items( $menu );

        $menu_list .= '<ul class="subheader-menu unstyled">';

        foreach( (array)$menu_items as $menu_item ) {

            $title = $menu_item->title;
            $url = $menu_item->url;
            $menu_list .= '<li><a class="" href="'.$url.'">' . $title . '</a></li>';


        $menu_list .= '</ul>';

        return $menu_list;


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Can't download / add sections
      By lucact+
      I can't download sections. I don't find the "Plagelines Connect" plugin so I don't know how to get any extra section/addon.
      Please, help.
    • Disapering sections
      By pehja+
      Just to let you know that once again a sections content are gone after a minor change in the theme. I have told you this before and this is just to let you know that there is a problem with DMS and sections. Any section!
      Regards Peter 
    • $this->opts for another post?
      By achim
      Dear all,
      I'm developing sections with dms. Is there an option to read $this->opt() from another post?
      Let's say I use post 456 to manage some data. Now I'm in post 123 and only want to show a certain teaser according to some settings in post 456.
      Would there be something like
      $other_post_data = $his->get_section_opts_by_post_id(456);or would I need to get this myself from the posts wp_options?
      As far as I know there's not much documentation about how Pagelines DMS stores data in wp_options so it might get a little tricky finding how handle those.
    • $this->opt not available
      By achim
      Dear all,
      I'm developing pagelines dms sections. Not sure but I have a feeling that 
      $this->opt('myoption')is only available in the function scope of section_template
      I tried to use it in section_persistent but could not access the data (while I could from section_template).
      When is section_persistent called? Before the data is read?
      Is there a better way of calling a function (to make up data e.g.) before running into section_template? I'd love to have as less logic as possible in section_template.
      Thanks in advance!
    • What Sections Were Used to Create "Our Team" on demo site?
      By Kempston+
      Good day all.
      I'd like to replicate the Our Team section on this page: http://themes.pagelines.com/dms/about-us/
      Could someone give me a quick rundown of the sections that would have been used to create it?
      Many thanks