[ 'label' => 'WooNooW', 'icon' => 'book-open', 'items' => [ [ 'slug' => 'getting-started', 'title' => 'Getting Started', 'file' => $docs_dir . '/getting-started.md', ], [ 'slug' => 'installation', 'title' => 'Installation', 'file' => $docs_dir . '/installation.md', ], [ 'slug' => 'troubleshooting', 'title' => 'Troubleshooting', 'file' => $docs_dir . '/troubleshooting.md', ], [ 'slug' => 'faq', 'title' => 'FAQ', 'file' => $docs_dir . '/faq.md', ], ], ], 'configuration' => [ 'label' => 'Configuration', 'icon' => 'settings', 'items' => [ [ 'slug' => 'configuration/appearance', 'title' => 'Appearance Settings', 'file' => $docs_dir . '/configuration/appearance.md', ], [ 'slug' => 'configuration/spa-mode', 'title' => 'SPA Mode', 'file' => $docs_dir . '/configuration/spa-mode.md', ], ], ], 'features' => [ 'label' => 'Features', 'icon' => 'layers', 'items' => [ [ 'slug' => 'features/shop', 'title' => 'Shop Page', 'file' => $docs_dir . '/features/shop.md', ], [ 'slug' => 'features/checkout', 'title' => 'Checkout', 'file' => $docs_dir . '/features/checkout.md', ], ], ], ]; /** * Filter: woonoow_docs_registry * * Allows addons to register their own documentation. * * @param array $docs Current documentation registry * @return array Modified documentation registry * * @example * add_filter('woonoow_docs_registry', function($docs) { * $docs['my-addon'] = [ * 'label' => 'My Addon', * 'icon' => 'puzzle', * 'items' => [ * [ * 'slug' => 'my-addon/getting-started', * 'title' => 'Getting Started', * 'file' => __DIR__ . '/docs/getting-started.md', * ], * ], * ]; * return $docs; * }); */ return apply_filters('woonoow_docs_registry', $docs); } /** * Get a single documentation item by slug * * @param string $slug Document slug * @return array|null Document data with content, or null if not found */ function get_doc_by_slug($slug) { $registry = get_docs_registry(); foreach ($registry as $section) { foreach ($section['items'] as $item) { if ($item['slug'] === $slug) { // Read file content if (file_exists($item['file'])) { $item['content'] = file_get_contents($item['file']); } else { $item['content'] = '# Document Not Found\n\nThis document is coming soon.'; } return $item; } } } return null; }