Custom grid layout
-
Hi Greg,
Apologies to keep contacting you for support! This will be my last topic for a while honest.
I believe the topic was touched on recently – with bootstrap, however, I’m using foundation CSS. I know you mentioned its not easily possible as your plugin is so deeply integrated with your own CSS.
I created a mapping function to count $cells and replace # columns where required.
$mapping_array=array(0=>1, 1=>12, 2=>6, 3=>4, 4=>3, 5=>3, 6=>2);
2 columns for example to 6 – as Foundation is a 12 grid based system so 2 columns, or 50%50% would be ‘large-6 columns’ as the CSS class.
<section id="bg<?php the_ID(); ?><?php echo $gi ?>"> <div class="row"> <?php foreach ( $cells as $ci => $widgets ) { <div class="large-<?php echo $mapped_value;?> columns">
…. was used instead of your code to keep the site uniform to foundation CSS.
Note the section id – the idea behind this was to be able to style a row with a background colour or image.
Anyway, after doing all this, I realised I’ve limited myself to specific uniform layouts, 1/2’s 1/3’s 1/4s – no possibility of a 80%20% layout for example.
So I was thinking, I could use this same process, with the % that are being created with your code? create an array to say that 50% would be 6 for example.
However, I’m struggling to find how the style % are being created? I can see its around here somewhere i think!
f ( $cell_count > 1 ) { $css_new = 'width:' . round( $cell['weight'] * 100, 0 ) . '%'; if ( empty( $css[1920][$css_new] ) ) $css[1920][$css_new] = array(); $css[1920][$css_new][] = '#pgc-' . $gi . '-' . $i;
$gi and $i are being called – $gi seems to be the row, and $i seems to be the columns? so its saying #pgc-1-1 width:50%; for example……. im not sure where that 50 is coming from though.
Could you help me figure out a way to call the % as I did with the..
<?php echo count($cells); ?>
?
Many thanks in advance if you’re able to help with this Greg, apologies for the massively long email!
- The topic ‘Custom grid layout’ is closed to new replies.