Forums
-
- Forum
- Posts
-
- Installing BuddyPress
- 23,840
- How-to & Troubleshooting
- 129,871
- Creating & Extending
- 25,903
- Requests & Feedback
- 9,548
- Third Party Plugins
- 9,832
- Showcase
- 3,316
- Ideas
- 1,402
- Miscellaneous
- 9,178
-
Why do you want to use code to add a widget to a theme ?
Go to dashboard > Apparence > Widget and do your stuff from there.
If your theme has widgetized areas, this is how you have to do. BP is only a plugin, not a “site” or a CMS.
Of course, if you build your own theme from scratch, you have to create such areas first in the theme’s functions.php.
https://codex.wordpress.org/WordPress_Widgets
https://codex.wordpress.org/Widgetizing_Themes