Created
September 12, 2025 02:20
-
-
Save askwpgirl/d4b5c8bff917664b9db14110bfb43a0b to your computer and use it in GitHub Desktop.
Register Widget Areas
This file contains hidden or 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 to Code Snippets plugin > New Snippet and Run Everywhere | |
| // Register Footer Widget Areas | |
| function mytheme_register_footer_widgets() { | |
| // Footer 1 | |
| register_sidebar( array( | |
| 'name' => __( 'Footer 1', 'mytheme' ), | |
| 'id' => 'footer-1', | |
| 'description' => __( 'Widgets in this area will be shown in Footer 1.', 'mytheme' ), | |
| 'before_widget' => '<div id="%1$s" class="widget %2$s">', | |
| 'after_widget' => '</div>', | |
| 'before_title' => '<h3 class="widget-title">', | |
| 'after_title' => '</h3>', | |
| ) ); | |
| // Footer 2 | |
| register_sidebar( array( | |
| 'name' => __( 'Footer 2', 'mytheme' ), | |
| 'id' => 'footer-2', | |
| 'description' => __( 'Widgets in this area will be shown in Footer 2.', 'mytheme' ), | |
| 'before_widget' => '<div id="%1$s" class="widget %2$s">', | |
| 'after_widget' => '</div>', | |
| 'before_title' => '<h3 class="widget-title">', | |
| 'after_title' => '</h3>', | |
| ) ); | |
| // Footer 3 | |
| register_sidebar( array( | |
| 'name' => __( 'Footer 3', 'mytheme' ), | |
| 'id' => 'footer-3', | |
| 'description' => __( 'Widgets in this area will be shown in Footer 3.', 'mytheme' ), | |
| 'before_widget' => '<div id="%1$s" class="widget %2$s">', | |
| 'after_widget' => '</div>', | |
| 'before_title' => '<h3 class="widget-title">', | |
| 'after_title' => '</h3>', | |
| ) ); | |
| // Footer 4 | |
| register_sidebar( array( | |
| 'name' => __( 'Footer 4', 'mytheme' ), | |
| 'id' => 'footer-4', | |
| 'description' => __( 'Widgets in this area will be shown in Footer 4.', 'mytheme' ), | |
| 'before_widget' => '<div id="%1$s" class="widget %2$s">', | |
| 'after_widget' => '</div>', | |
| 'before_title' => '<h3 class="widget-title">', | |
| 'after_title' => '</h3>', | |
| ) ); | |
| } | |
| add_action( 'widgets_init', 'mytheme_register_footer_widgets' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment