Home / Forums / DynamiX Support / Custom Columns

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts

  • Rich
    Participant

    I ran into a situation where I wanted 4 columns and each one formatted differently. I haven't really looked into the shortcodes much so I thought I would see if I could get it to work with that.

    Essentially I just added another parameter for the shortcodes called catclass. In my case I was adding the 4 categories I had and wanted each one have a different background. I also thought it could help for later things I wanted to do as well.

    I opened up lib/inc/shortcodes.php

    add at line 2864

    'catclass' => '',

    change line 2903 (after the add above) from

    return '<div class="columns '. $class .' '. esc_attr($border) .'"'. $height.'><div>'. do_shortcode($content) .'</div></div>';

    to

    return '<div class="columns '. $class .' '. esc_attr($border) .' '. $catclass .'"'. $height.'><div>'. do_shortcode($content) .'</div></div>';

    change line 2905 (after the add above) from

    return '<div class="columns '. $class .' '. esc_attr($border) .'"'. $height.'><div>'. do_shortcode($content) .'</div></div><div class="clear"></div>';

    to

    return '<div class="columns '. $class .' '. esc_attr($border) .' '. $catclass .'"'. $height.'><div>'. do_shortcode($content) .'</div></div><div class="clear"></div>';

    Now when calling the shortcode I can add additional formatting in the Add Custom CSS area in the skin settings.

    Call the shortcode like so and change classname to whatever class you add to Custom CSS 

    [four_columns border="border" catclass="classname"] [/four_columns]

    It's probably just as easy to format directly in the editor but thought I would try it this way to be reused whenever I wanted and to help learn the ins and outs of how the theme works. I didn't go as far as editing the shortcode generator to include the new parameter though. Maybe if I have time I'll add that later.

    Andy
    Andy
    Keymaster

    Thanks for the share Rich, I've already done some work to add custom classes to shortcodes – it should make it's way to DynamiX in the near future. 

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.