Last active
February 7, 2018 18:21
-
-
Save erikkowalski/3d85a306d5d7254e2602 to your computer and use it in GitHub Desktop.
Apply a .container or .container-fluid bootstrap class to base.php file in roots based Wordpress Theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Return .container or .container-fluid | |
* Add This to lib/extras.php | |
*/ | |
function container_selector( $page_url, $full_width_pages ){ | |
if ( in_array( $page_url, $full_width_pages ) ){ | |
return 'container-fluid'; | |
} else { | |
return 'container'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add this to base.php | |
* Add pages to the $full_width_pages array that you want to have a .container-fluid | |
* echo $container on the .wrap element | |
*/ | |
<?php | |
$url = basename( Wrapper\template_path() ); | |
$full_width_pages = [ 'front-page.php', 'page-about.php', ]; | |
$container = Roots\Sage\Extras\container_selector( $url, $full_width_pages ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment