Using the API
The window.Overedge API is available globally after adding the CDN script.
Wait for ready
Always use onReady() before calling methods:
javascript
window.Overedge.onReady(function () {
// Safe to use API here
});Fetch content
javascript
// Posts
window.Overedge.getContent('posts', { per_page: 6 });
// Custom content types
window.Overedge.getContent('courses');
window.Overedge.getContent('events');
window.Overedge.getContent('team_members');
// Pages
window.Overedge.getContent('pages');Full API reference
| Method | Description |
|---|---|
| onReady(callback) | Fires when connected |
| isReady() | Check if connected |
| getConfig() | Get site configuration |
| getContent(type, params) | Fetch any content |
| getSettings() | Get site settings |
| clearCache() | Clear cached data |
The useOveredge hook
For React projects use the hook instead:
tsx
const { data, loading, error } =
useOveredge('posts', { per_page: 6 });Parameters:
contentType— WordPress post type slugparams— optional query params:per_page— number of itemsslug— fetch by specific slugorderby— sort order