WordPress plugin that manages notification functionality for WPCampus websites. Uses the WordPress REST API.
You can view the notifications JSON feed at https://wpcampus.org/wp-json/wp/v2/notifications.
The majority of the code that adds the notifications to the WPCampus websites exists in our network plugin. We use mustache templating to display the notifications. The mustache template for each website exists in its own theme.
- Include the mustache npm package.
- Make sure the mustache file is copied to your assets folder.
- Create the Javascript file to get the notifications and use to populate the mustache template.
- We keep our script in our network plugin so it's in one place and always available/loaded for each site.
- Enqueue the notifications script.
- We also load our script in our network plugin.
- Be sure to add the mustache template. The mustache template for each of our websites exists in its own theme:
This repo is shared for educational purposes. Feel free to explore, copy, submit fixes, and share the code.
However, please respect that the WPCampus branding and design are intended solely for the WPCampus organization.