Jump to content


Photo

Column width


Best Answer keithmagvacom , 07 May 2013 - 07:39 PM

Just an update on this. I located the code that was required to enable the functionality. Adam originally pointed me to a website that is no longer live. This code was added to the functions.php file (Not a good practice).

 
function atlas_clean_shortcode_content( $content ) {
 
    /* Parse nested shortcodes and add formatting. */
    $content = trim( wpautop( do_shortcode( $content ) ) );
 
    /* Remove '</p>' from the start of the string. */
    if ( substr( $content, 0, 4 ) == '</p>' )
        $content = substr( $content, 4 );
 
    /* Remove '<p>' from the end of the string. */
    if ( substr( $content, -3, 3 ) == '<p>' )
        $content = substr( $content, 0, -3 );
 
    /* Remove any instances of '<p></p>'. */
    $content = str_replace( array( '<p></p>' ), '', $content );
 
    return $content;
}
 
/**
 * Flexible columns shortcode.
 * @param array $atts array of shortcode attributes
 * @param string $content the content between the shortcode tags
 * @return string
 */
function atlas_column_shortcode( $atts, $content = '' ) {
 
    /* Extract shortcode attributes. */
    extract( shortcode_atts( array(
      'width' => '45%',
      'spacing' => '0',
        ), $atts ) );
 
    /* Parse any nested shortcodes and clean up the formatting. */
    $content = atlas_clean_shortcode_content( $content );
 
    /* Assemble the output. */
    $style = "style='float: left; width: {$width}; margin-right: {$spacing};'";
    $output = "<div {$style}>{$content}</div>";
 
    return $output;
}
 
/**
 * Clear shortcode columns.
 * @return string
 */
function atlas_clear_columns_shortcode() {
    return "<div style='clear: both;'></div>";
}
 
/* Register column shortcodes. */
add_shortcode( 'column', 'atlas_column_shortcode' );
add_shortcode( 'end-columns', 'atlas_clear_columns_shortcode' );

Then in on the page add this changing the %'s

 
[column width='30.66%' spacing='4%']
Your content goes here.
[/column]
 
[column width='30.66%' spacing='4%']
Your content goes here.
[/column]
 
[column width='30.66%']
Your content goes here.
[/column]
 
[end-columns]
Go to the full post


  • Please log in to reply
10 replies to this topic

#1 keithmagvacom

keithmagvacom

    Advocate

  • Members



  • 361 posts
  • Framework Version:2.4
  • Country: Country Flag

Posted 06 May 2013 - 03:00 PM

Hi Folks.

 

I am having a problem with a site and in particular the URL: http://www.etterhors...new_site/links/

 

As you can see there is [column width=....] [/column] contained in the page. If I recall Adam pointed me towards this feature and I suspect there is some code that needs to be added somewhere which was over written during an update. Can't seem to locate the original question and solution in the forum and wondering if anyone recognises it. 

 

Thanks in advance

 



#2 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 06 May 2013 - 04:05 PM

Can you please e-mail your site log-in to hello@pagelines.com?



#3 keithmagvacom

keithmagvacom

    Advocate

  • Members



  • 361 posts
  • Framework Version:2.4
  • Country: Country Flag

Posted 06 May 2013 - 04:13 PM

Hi Catrina

You might try it now. I didn't realise that I had a PW on the site folder.
If the PW popup appears just cancel it (twice) and you should be on the site.

#4 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 06 May 2013 - 09:40 PM

Keith,

 

Nothing I know of uses [column...] in PageLines own code, unless I'm missing something.  Is this a plugin? Is it activated?



#5 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 06 May 2013 - 09:46 PM

You could achieve the same results using boxes or soapboxes. Have you tried those?

 

The shortcodes you're using belong to this plugin:

http://wordpress.org...s/column-matic/



#6 keithmagvacom

keithmagvacom

    Advocate

  • Members



  • 361 posts
  • Framework Version:2.4
  • Country: Country Flag

Posted 06 May 2013 - 11:00 PM

Hi Rob

It's going back a few years, and a site I build using PlatformPro. I think Adam Munns give me the fix, but I can't located the original post in the forum. It was a method of creating columns, but I think there is some additional code needed. It wasn't available out of the box in pagelines, but could be implemented.

#7 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 06 May 2013 - 11:07 PM

Keith,

 

I've been using PageLines products since before PlatformPro. I dont' ever recall this as previous editions didn't really use shortcodes as Framework does now. The code Adam gave you is part of a plugin. He may have recommended it, and described how to implement it.

 

As I mentioned above, those codes work with the plugin I linked.  I do recall many people asking in my earlier days here about columns, and we've always recommended boxes, soapboxes, or plugins.



#8 James B

James B

    Advocate

  • Members

  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 07 May 2013 - 01:50 AM

Hi Keith

 

I think this code was done through a plugin, i think jw shortcodes had that setup for creating columns.

 

However, you can now create that using shortcodes from inside Pagelines now, using the Pagelines grid (as you're using the Framework now etc).

 

The grid uses html code, you can see an example of the code which uses spans to create the columns here http://demo.pagelines.me/tools/

 

However, one of our developers has done a free shortcode version (which will be even easier), you can find that at - http://www.pagelines...rid-shortcodes/



#9 keithmagvacom

keithmagvacom

    Advocate

  • Members



  • 361 posts
  • Framework Version:2.4
  • Country: Country Flag

Posted 07 May 2013 - 07:39 PM   Best Answer

Just an update on this. I located the code that was required to enable the functionality. Adam originally pointed me to a website that is no longer live. This code was added to the functions.php file (Not a good practice).

 
function atlas_clean_shortcode_content( $content ) {
 
    /* Parse nested shortcodes and add formatting. */
    $content = trim( wpautop( do_shortcode( $content ) ) );
 
    /* Remove '</p>' from the start of the string. */
    if ( substr( $content, 0, 4 ) == '</p>' )
        $content = substr( $content, 4 );
 
    /* Remove '<p>' from the end of the string. */
    if ( substr( $content, -3, 3 ) == '<p>' )
        $content = substr( $content, 0, -3 );
 
    /* Remove any instances of '<p></p>'. */
    $content = str_replace( array( '<p></p>' ), '', $content );
 
    return $content;
}
 
/**
 * Flexible columns shortcode.
 * @param array $atts array of shortcode attributes
 * @param string $content the content between the shortcode tags
 * @return string
 */
function atlas_column_shortcode( $atts, $content = '' ) {
 
    /* Extract shortcode attributes. */
    extract( shortcode_atts( array(
      'width' => '45%',
      'spacing' => '0',
        ), $atts ) );
 
    /* Parse any nested shortcodes and clean up the formatting. */
    $content = atlas_clean_shortcode_content( $content );
 
    /* Assemble the output. */
    $style = "style='float: left; width: {$width}; margin-right: {$spacing};'";
    $output = "<div {$style}>{$content}</div>";
 
    return $output;
}
 
/**
 * Clear shortcode columns.
 * @return string
 */
function atlas_clear_columns_shortcode() {
    return "<div style='clear: both;'></div>";
}
 
/* Register column shortcodes. */
add_shortcode( 'column', 'atlas_column_shortcode' );
add_shortcode( 'end-columns', 'atlas_clear_columns_shortcode' );

Then in on the page add this changing the %'s

 
[column width='30.66%' spacing='4%']
Your content goes here.
[/column]
 
[column width='30.66%' spacing='4%']
Your content goes here.
[/column]
 
[column width='30.66%']
Your content goes here.
[/column]
 
[end-columns]


#10 James B

James B

    Advocate

  • Members

  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 07 May 2013 - 08:04 PM

Hi Keith,

 

Ah ok, it was a php solution. I definitely say you're better off with the grid shortcodes that using that now that pagelines has it embedded. Well done for tracking it down though, I went through the forum search a couple of times looking for a previous post with the code in but couldn't track it down.


  • keithmagvacom likes this

#11 keithmagvacom

keithmagvacom

    Advocate

  • Members



  • 361 posts
  • Framework Version:2.4
  • Country: Country Flag

Posted 07 May 2013 - 08:08 PM

The grid shortcuts are the way to go. I guess this was a fix before them. I had trouble tacking it also myself, but eventually I decided to google my own username and column and it popped me back to a post where I had shared it with someone else also. It's a shame we can't search for our old posts