Skip to content

Commit

Permalink
Make compatible with Bootstrap 4:
Browse files Browse the repository at this point in the history
- Change every 'col-' to 'owp-col-' (except WooCommerce releated stuff, because there are also col-1, col-2 classes -> woocommerce/woocommerce#15793)
- Add max-width: unset and display: block to WooCommerce to make sure Bootstrap forms work
- Add custom CSS to _navigation.scss to make navigation work with Bootstrap
- Recompile style.css and woocommece.css
  • Loading branch information
LORDofDOOM committed Sep 23, 2018
1 parent eef5903 commit bb06520
Show file tree
Hide file tree
Showing 16 changed files with 534 additions and 161 deletions.
620 changes: 491 additions & 129 deletions assets/css/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/style.min.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions assets/css/woo/woocommerce.css
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@

.woocommerce form .form-row {
padding: 3px 0;
display: block;
}

.woocommerce form .form-row label {
Expand Down Expand Up @@ -2273,11 +2274,13 @@
.col2-set .col-1 {
float: left;
width: 48%;
max-width: unset;
}

.col2-set .col-2 {
float: right;
width: 48%;
max-width: unset;
}

@media only screen and (min-width: 481px) and (max-width: 768px) {
Expand Down
2 changes: 1 addition & 1 deletion assets/css/woo/woocommerce.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inc/edd/edd-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static function add_download_classes( $classes ) {
// Counter
global $oceanwp_count;
if ( $oceanwp_count ) {
$classes[] = 'col-'. $oceanwp_count;
$classes[] = 'owp-col-'. $oceanwp_count;
}

return $classes;
Expand Down
2 changes: 1 addition & 1 deletion inc/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2392,7 +2392,7 @@ function oceanwp_post_entry_classes() {
// Counter
global $oceanwp_count;
if ( $oceanwp_count ) {
$classes[] = 'col-'. $oceanwp_count;
$classes[] = 'owp-col-'. $oceanwp_count;
}

// Apply filters to entry post class for child theming
Expand Down
4 changes: 2 additions & 2 deletions inc/walker/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public function add_custom_fields( $id, $item, $depth, $args ) { ?>
</label>
</p>
<p class="field-megamenu-columns description description-wide">
<label for="edit-menu-item-megamenu_col-<?php echo esc_attr( $item->ID ); ?>">
<label for="edit-menu-item-megamenu_owp-col-<?php echo esc_attr( $item->ID ); ?>">
<?php esc_html_e( 'Megamenu columns (from 1 to 6)', 'oceanwp' ); ?><br />
<input type="number" id="edit-menu-item-megamenu_col-<?php echo esc_attr( $item->ID ); ?>" class="widefat code edit-menu-item-custom" name="menu-item-megamenu_col[<?php echo esc_attr( $item->ID ); ?>]" min="1" max="6" value="<?php echo esc_attr( $item->megamenu_col ); ?>" />
<input type="number" id="edit-menu-item-megamenu_owp-col-<?php echo esc_attr( $item->ID ); ?>" class="widefat code edit-menu-item-custom" name="menu-item-megamenu_col[<?php echo esc_attr( $item->ID ); ?>]" min="1" max="6" value="<?php echo esc_attr( $item->megamenu_col ); ?>" />
</label>
</p>
<p class="field-megamenu-heading description description-wide">
Expand Down
4 changes: 2 additions & 2 deletions inc/walker/menu-walker.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);

// Megamenu columns
$col = ! empty( $this->megamenu_col ) ? ( 'col-'. $this->megamenu_col .'' ) : 'col-2';
$col = ! empty( $this->megamenu_col ) ? ( 'owp-col-'. $this->megamenu_col .'' ) : 'owp-col-2';

if( $depth === 0 && $this->megamenu != '' && 'full_screen' != oceanwp_header_style() && 'vertical' != oceanwp_header_style() ) {
$output .= "\n$indent<ul class=\"megamenu ". $col ." sub-menu\">\n";
Expand Down Expand Up @@ -251,7 +251,7 @@ public function end_el( &$output, $item, $depth = 0, $args = array() ) {
&& 'full_screen' != $header_style && 'vertical' != $header_style ) {
global $post;

$output .= "\n<ul class=\"megamenu col-4 sub-menu\">\n";
$output .= "\n<ul class=\"megamenu owp-col-4 sub-menu\">\n";

// Sub Categories ===============================================================
if ( $item->category_post != '' && $item->object == 'category' ) {
Expand Down
8 changes: 4 additions & 4 deletions partials/footer/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,30 @@
} else {

// Footer box 1 ?>
<div class="footer-box <?php echo esc_attr( $grid_class ); ?> col col-1">
<div class="footer-box <?php echo esc_attr( $grid_class ); ?> col owp-col-1">
<?php dynamic_sidebar( 'footer-one' ); ?>
</div><!-- .footer-one-box -->

<?php
// Footer box 2
if ( $columns > '1' ) : ?>
<div class="footer-box <?php echo esc_attr( $grid_class ); ?> col col-2">
<div class="footer-box <?php echo esc_attr( $grid_class ); ?> col owp-col-2">
<?php dynamic_sidebar( 'footer-two' ); ?>
</div><!-- .footer-one-box -->
<?php endif; ?>

<?php
// Footer box 3
if ( $columns > '2' ) : ?>
<div class="footer-box <?php echo esc_attr( $grid_class ); ?> col col-3 ">
<div class="footer-box <?php echo esc_attr( $grid_class ); ?> col owp-col-3 ">
<?php dynamic_sidebar( 'footer-three' ); ?>
</div><!-- .footer-one-box -->
<?php endif; ?>

<?php
// Footer box 4
if ( $columns > '3' ) : ?>
<div class="footer-box <?php echo esc_attr( $grid_class ); ?> col col-4">
<div class="footer-box <?php echo esc_attr( $grid_class ); ?> col owp-col-4">
<?php dynamic_sidebar( 'footer-four' ); ?>
</div><!-- .footer-box -->
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion partials/header/style/medium-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
$e_classes = array( 'top-col', 'clr' );

// Count
$e_classes[] = 'col-'. $count;
$e_classes[] = 'owp-col-'. $count;

// If logo
if ( 'logo' == $element ) {
Expand Down
2 changes: 1 addition & 1 deletion partials/single/related-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
// Add classes
$classes = array( 'related-post', 'clr', 'col' );
$classes[] = oceanwp_grid_class( $oceanwp_columns );
$classes[] = 'col-'. $oceanwp_count; ?>
$classes[] = 'owp-col-'. $oceanwp_count; ?>

<article <?php post_class( $classes ); ?>>

Expand Down
4 changes: 2 additions & 2 deletions sass/base/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ body .oceanwp-row {
* Grid > Clear Floats.
*/
.count-1,
.col-1,
.owp-col-1,
.col.first {
clear: both;
margin-left: 0;
Expand Down Expand Up @@ -201,7 +201,7 @@ form.oceanwp-searchform {

/* turn 4 column masonry grids into 2 columns */
body .oceanwp-row {
.span_1_of_4.col-3.col,
.span_1_of_4.owp-col-3.col,
.span_1_of_4.col.product:nth-child(2n+3) {
margin-left: 0;
clear: both;
Expand Down
6 changes: 3 additions & 3 deletions sass/components/header/_header-medium.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
-webkit-flex: 1 0 0%;
flex: 1 0 0%;

&.col-1 {
&.owp-col-1 {
text-align: left;
}

&.col-2,
&.owp-col-2,
&.logo-col {
text-align: center;
}

&.col-3 {
&.owp-col-3 {
text-align: right;
}
}
Expand Down
26 changes: 13 additions & 13 deletions sass/components/header/_megamenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@
* Megamenu columns
*/
.navigation li.megamenu-li .megamenu {
&.col-1 > li { width: 100%; }
&.col-2 > li { width: 50%; }
&.col-3 > li { width: 33.33333333%; }
&.col-4 > li { width: 25%; }
&.col-5 > li { width: 20%; }
&.col-6 > li { width: 16.66666667%; }
&.owp-col-1 > li { width: 100%; }
&.owp-col-2 > li { width: 50%; }
&.owp-col-3 > li { width: 33.33333333%; }
&.owp-col-4 > li { width: 25%; }
&.owp-col-5 > li { width: 20%; }
&.owp-col-6 > li { width: 16.66666667%; }
}

/**
* Megamenu auto width
*/
@media only screen and (min-width: 959px) {
.navigation li.megamenu-li.auto-mega .megamenu {
&.col-1 { width: 320px; }
&.col-2 { width: 440px; }
&.col-3 { width: 660px; }
&.col-4 { width: 780px; }
&.col-5 { width: 980px; }
&.col-6 { width: 1080px; }
&.owp-col-1 { width: 320px; }
&.owp-col-2 { width: 440px; }
&.owp-col-3 { width: 660px; }
&.owp-col-4 { width: 780px; }
&.owp-col-5 { width: 980px; }
&.owp-col-6 { width: 1080px; }
}
}

Expand Down Expand Up @@ -185,7 +185,7 @@
@media only screen and (min-width: 768px) and (max-width: 1280px) {

/* megamenu */
.navigation li.megamenu.auto-width.col-6 > .sub-menu {
.navigation li.megamenu.auto-width.owp-col-6 > .sub-menu {
width: 980px;
}

Expand Down
5 changes: 5 additions & 0 deletions sass/components/header/_navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
list-style: none;
margin: 0;
padding: 0;
position: relative;
top: auto;
display: block;
border: 0;
background-color: transparent;

> li {
float: left;
Expand Down
3 changes: 3 additions & 0 deletions sass/woo/_woocommerce.scss
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@
form {
.form-row {
padding: 3px 0;
display: block;
label {
display: inline-block;
margin: 0 0 5px;
Expand Down Expand Up @@ -1836,10 +1837,12 @@
.col-1 {
float: left;
width: 48%;
max-width: unset;
}
.col-2 {
float: right;
width: 48%;
max-width: unset;
}
}
@media only screen and(min-width: 481px) and(max-width: 768px) {
Expand Down

0 comments on commit bb06520

Please sign in to comment.