SHOW:
|
|
- or go back to the newest paste.
1 | /*==================function for register widgets=================*/ | |
2 | ||
3 | ||
4 | function brightpage_widget_areas() { | |
5 | ||
6 | register_sidebar( array( | |
7 | 'name' => __( 'Sidebar name', 'brightpage' ), | |
8 | 'id' => 'sidebar_id', | |
9 | 'description' => __( 'An optional widget area for your welcome message area.', 'brightpage' ), | |
10 | 'before_widget' => '<div class="big">', | |
11 | 'after_widget' => '</div>', | |
12 | 'before_title' => '', | |
13 | 'after_title' => '', | |
14 | ) ); | |
15 | ||
16 | ||
17 | register_sidebar( array( | |
18 | 'name' => __( 'Sidebar name', 'brightpage' ), | |
19 | 'id' => 'sidebar_id', | |
20 | 'description' => __( 'An optional widget area for your welcome message area.', 'brightpage' ), | |
21 | 'before_widget' => '<div class="big">', | |
22 | 'after_widget' => '</div>', | |
23 | 'before_title' => '', | |
24 | 'after_title' => '', | |
25 | ) ); | |
26 | ||
27 | } | |
28 | add_action('widgets_init', 'brightpage_widget_areas'); | |
29 | ||
30 | ||
31 | ||
32 | /*Paste this code in your widget position*/ | |
33 | <?php dynamic_sidebar('sidebar_id'); ?> | |
34 | ||
35 | ||
36 | ||
37 | ||
38 | <?php if ( ! dynamic_sidebar( 'sidebar-right' ) ) : ?> | |
39 | - | <?php endif; ?> |
39 | + | <?php endif; ?> |
40 | ----------------------------------------------------- | |
41 | /* Default way Paste this code in your widget position*/ | |
42 | ||
43 | <?php if ( is_active_sidebar( 'widget-id' ) ) : ?> | |
44 | <div id="widget-area" class="widget-area" role="complementary"> | |
45 | <?php dynamic_sidebar( 'widget-id' ); ?> | |
46 | </div><!-- .widget-area --> | |
47 | <?php endif; ?> | |
48 | ||
49 | /* Widgest show code style 2 new version */ | |
50 | <?php | |
51 | if(is_active_sidebar("footer-widgets")){ | |
52 | dynamic_sidebar("footer-widgets"); | |
53 | } | |
54 | else{ | |
55 | echo "<h4 style='text-align: center;'>Please add some widgets here</h4>"; | |
56 | } | |
57 | ?> |