minieleven theme add widget before footer
-
I want to add a widget before the footer in the minieleven theme.
Currently I can add only a widget after the footer by using code similar to the following in a plugin.
// Check if we are on mobile function jetpackme_is_mobile() { // Are Jetpack Mobile functions available? if ( ! function_exists( 'jetpack_is_mobile' ) ) return false; // Is Mobile theme showing? if ( isset( $_COOKIE['akm_mobile'] ) && $_COOKIE['akm_mobile'] == 'false' ) return false; return jetpack_is_mobile(); } function jetpackme_after_footer( $content ) { // widget code echo '<div class="footer-widget"></div>'; } if ( jetpackme_is_mobile() ) { add_action( 'wp_footer', 'jetpackme_after_footer', 10, 0 ); }
However, I want to add a widget above the footer, so that it would look like this:
</div><!-- #wrapper --> <div class="footer-widget"></div> <footer id="colophon" role="contentinfo">
If there was a hook before the footer similar to the following, then we can easily add a widget before the footer
</div><!-- #wrapper --> <?php /** * Fires before the footer */ do_action( 'jetpack_mobile_footer_before' ); ?> <footer id="colophon" role="contentinfo">
By adding this hook we can use the code similar to following to add widget before the footer
function jetpackme_before_footer( $content ) { // widget code echo '<div class="footer-widget"></div>'; } if ( jetpackme_is_mobile() ) { add_action( 'jetpack_mobile_footer_before', 'jetpackme_before_footer', 10, 0 ); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘minieleven theme add widget before footer’ is closed to new replies.