2

Sorry, I am a newbie in both PHP and CSS...

I am trying to change Evolve (WordPress) theme to make it 8 columns on a frontpage but since this theme is using Bootstrap with 12 grid system, I cannot manage to create 8 even columns. I'm changing the file called basic-functions.php and I don't know what (and where can I do to have 8 even columns).

switch ( $BoxCount ):
            case $BoxCount == 8:
            $BoxClass = 'col-md-2'; 

            break;

        default:
            $BoxClass = 'col-md-3';
endswitch;

I can understand that when the $BoxClass = 'col-md-2';, then I will have 6 columns in a row and under another 2 columns...

Now, it looks like this:

1]

How can I make 8 columns in a row? (with or without gap)?

r5d
  • 579
  • 5
  • 24
caleemack
  • 23
  • 1
  • 3
  • This question is a duplicate of a question asked 6 months earlier. – jdero Sep 07 '17 at 20:32
  • Possible duplicate of [8 Columns in Twitter Bootstrap](https://stackoverflow.com/questions/20287867/8-columns-in-twitter-bootstrap) – jdero Sep 07 '17 at 20:32

2 Answers2

5

You have to edit your template so you can generate something like this:

<div class="row">
    <div class="col-xs-6">
        <div class="row">
            <div class="col-xs-3">
                        1
            </div>
            <div class="col-xs-3">
                        2
            </div>
            <div class="col-xs-3">
                        3
            </div>
            <div class="col-xs-3">
                        4
            </div>
        </div>
    </div> 
    <div class="col-xs-6">
        <div class="row">
            <div class="col-xs-3">
                        5   
            </div>
            <div class="col-xs-3">
                        6
            </div>
            <div class="col-xs-3">
                    7
            </div>
            <div class="col-xs-3">
                    8
            </div>
        </div>
    </div>
</div>

Its basically 12 grid layout cut in half, then those halfs are made 12 grid layout and divided by 4, which ultimately results in 8 grid column. You can't do it with your solution, because you cant divide 12 to become 4 equal parts (it would be something like col-md-1,5 and you obviously cant make something like this in bootstrap)

source: 8 Columns in Twitter Bootstrap

UPDATE: It's not as easy as copypasting this code somewhere, you would have to modify the code on many places. We can maybe try more "dirty" approach. Try this:

Paste this code to the end of your .css file:

.col-8-custom{
width: 12.5%;
}

And change the code you originally pasted into:

switch ( $BoxCount ):
            case $BoxCount == 8:
            $BoxClass = 'col-8-custom'; 

            break;

        default:
            $BoxClass = 'col-md-3';
endswitch;
Community
  • 1
  • 1
  • hey, thank you for your answer.. I understand i cannot make it with col-md-1,5.. So where exactly should i post your code? i'm trying to edit this template so i would have 8 content boxes (not only 4 as it is by default).. https://wordpress.org/themes/evolve/ – caleemack Sep 15 '15 at 11:36
  • thank you man, I owe you. I edited both bootstrap.css and basic-functions.php as you said and IT WORKS!!! thank you very much – caleemack Sep 15 '15 at 14:31
  • heh, i just thought of this solution and was about to post it, but its there already – DarkMukke Sep 15 '15 at 15:31
1

Welcome to stack overflow.

Bootstrap and it's grid got nothing to do with php though, it's all in the css and less files. Now you might not have any less files but otherwise you could customise the boostrap grid system to have 8 columns instead of 12. You can also rebuild and customise the framework on their website here

If you dont want to modify the grid and you want even centered columns you could work with an offset

<!-- First line has the offset -->
<div class="col-md-offset-2 col-md-2">
DarkMukke
  • 2,469
  • 1
  • 23
  • 31
  • Hello, thank you very much for your quick answer. I'm sorry that I'm got so lame questions but: 1) your first solution - I have tried to replace the whole folder "Bootstrap" with the new "Bootstrap" folder generated from the website with the config that uses grid with 8 columns, but it broke the whole website... i don't know what's the less files.. There is a folder in Evolve wordpress theme called "Bootstrap" but there is no file such as config.json.... 2) I would try this solution but don't know exactly what offset is and where I should put this line.. thanks :-) – caleemack Sep 15 '15 at 09:41
  • you should only replace the bootstrap.css or bootstrap.min.css file, nothing else, because yes thatw ill break the whole site. Problem is th rest of your site is probably build for a 12 grid system so you can't expect to just fix it by replacing the bootstrap files, it will need some work to change the whole site over, thats why i gave you the 2nd solution, edit your post with some more code an i can edit my asnwer as of where you should put the offset – DarkMukke Sep 15 '15 at 10:09
  • hello, thank you for your answer, you're just great. I don't know what code exactly you have to see so you could help me. now I'm just at the start of the project so basically, you can check the files (style.css, basic-functions.php, etc.) when you download the Evolve theme https://wordpress.org/themes/evolve/. I've made just few changes in file called basic-functions.php but I can easily "replace" them when you'll send me what exactly (and where) i should do.. thank you very much – caleemack Sep 15 '15 at 11:27
  • btw. I've tried to change bootstrap.css with 16 grid system - the content boxes looked fine (finally) but rest of the page was "broken" and I didn't find all the files and code that I would have to edit so i could make it with 16 grid system.. – caleemack Sep 15 '15 at 11:30