Skip to content

Commit

Permalink
Add before/after <main> content hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
cabgfx committed Nov 2, 2021
1 parent 23bb0ad commit 9eff2ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Bare-bones theme configuration using SCSS for [Roots](http://roots.io/), a WordP
* VS Code with [LiveSass](https://marketplace.visualstudio.com/items?itemName=ritwickdey.live-sass) for simple and easy SCSS compiling is preferred, but not required.
* I recommend using [WP Rocket](https://wp-rocket.me/) for optimizing asset delivery on your live site.


### Assets
* Only a subset of Bootstrap CSS included by default. To add more, uncomment the `@import`'s you need in `assets/scss/_bootstrap.scss`. (All Bootstrap files are kept pristine and update-friendly.)
* Almost no default Bootstrap JS included initially, and `assets/js/main.js` only includes the `Roots` namespace + DOM-based Routing.
Expand All @@ -22,3 +21,15 @@ Bare-bones theme configuration using SCSS for [Roots](http://roots.io/), a WordP
* Google Analytics tracking code is only included if `WPBP_ENV == 'production'` and no user is logged in. (Note: the `WPBP_ENV` constant is defined in the [WordPress Boilerplate config package](https://github.com/cabgfx/wpbp-config), but the theme is fully functional without it.)
* All theme activation options are off by default, to prevent “accidents” when installing the theme on sites with existing content.
* No “You're using an outdated browser…” message for IE8 and below.

### Actions

`wpbp-before-main`

Called before the main.. `<main>` content wrapper.

Ideal for rendering eg. a Custom Header for your child theme.

`wpbp-after-main`

Called after the main.. `<main>` content wrapper.
4 changes: 4 additions & 0 deletions base.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
}
?>

<?php do_action('wpbp-before-main'); ?>

<div class="wrap container" role="document">
<div class="content row">
<main class="main <?php echo roots_main_class(); ?>" role="main">
Expand All @@ -24,6 +26,8 @@
</div><!-- /.content -->
</div><!-- /.wrap -->

<?php do_action('wpbp-after-main'); ?>

<?php get_template_part('templates/footer'); ?>

</body>
Expand Down

0 comments on commit 9eff2ee

Please sign in to comment.