{"id":21700689,"url":"https://github.com/awps/adminpage","last_synced_at":"2025-03-20T15:43:34.540Z","repository":{"id":72119770,"uuid":"48243719","full_name":"awps/AdminPage","owner":"awps","description":"Advanced  WordPress Admin pages, the easy way...","archived":false,"fork":false,"pushed_at":"2016-01-15T13:44:23.000Z","size":29,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T15:08:53.800Z","etag":null,"topics":["admin","admin-dashboard","wordpress","wordpress-development","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-18T16:00:00.000Z","updated_at":"2024-10-24T07:01:22.000Z","dependencies_parsed_at":"2023-02-27T16:45:56.917Z","dependency_job_id":null,"html_url":"https://github.com/awps/AdminPage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awps%2FAdminPage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awps%2FAdminPage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awps%2FAdminPage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awps%2FAdminPage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awps","download_url":"https://codeload.github.com/awps/AdminPage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244645074,"owners_count":20486924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["admin","admin-dashboard","wordpress","wordpress-development","wordpress-plugin"],"created_at":"2024-11-25T20:16:09.715Z","updated_at":"2025-03-20T15:43:34.521Z","avatar_url":"https://github.com/awps.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZeroWP - AdminPage\nAdvanced  WordPress Admin pages, the easy way...\n\n###License: GPL\nThe license allows the usage in any projects(personal or commercial). An attribution link is not required, but very appreciated.\n\n##Requirements:\n\n * PHP 5.3+\n \n##How to use:\n###Include the files\n```php\nrequire_once dirname(__FILE__) . \"/src/AdminPage/mod.php\";\n```\n\n###Create a page\n```php\nclass ExamplePage extends ZeroWP\\Admin\\Page{\n\n\tpublic function settings(){\n\t\treturn array(\n\t\t\t'parent_slug' =\u003e false, // This is a parent page, not a subpage\n\t\t\t'menu_title'  =\u003e __('Example page', 'text-domain'),\n\t\t);\n\t}\n\n\tpublic function page(){\n\t  echo 'Page content here!';\n\t}\n}\n$example_page = new ExamplePage('page-slug');\n$example_page-\u003einit(); //Initialize this page.\n```\n\nThe page is available at: *[site_url]/wp-admin/admin.php?page=`page-slug`*\n\n###Create a tab\n```php\nclass ExampleTab extends ZeroWP\\Admin\\Tab{\n\n\tpublic function settings(){\n\t\treturn array(\n\t\t\t'label' =\u003e __('Tab title', 'text-domain')\n\t\t);\n\t}\n\n\tpublic function page(){\n\t  echo 'Tab content here!';\n\t}\n}\nnew ExampleTab('tabid', 'page-slug');\n```\n\nThe tab is available at: *[site_url]/wp-admin/admin.php?`page=page-slug\u0026tab=tabid`*\n\n###All available settings for pages: `ZeroWP\\Admin\\Page`\n\nAll settings are optional. Use only that you need.\n\n```php\npublic function settings(){\n\treturn array(\n\t\t'menu_title'    =\u003e '',\n\t\t'page_title'    =\u003e '',\n\t\t'parent_slug'   =\u003e null,\n\t\t'capability'    =\u003e 'manage_options',\n\t\t'menu_icon'     =\u003e '',\n\t\t'menu_position' =\u003e null,\n\t\t'default_tab_label' =\u003e '',\n\t);\n}\n```\n\n* **'menu_title'**\u003cbr /\u003e\n\tDefault: `''`.  The menu title. If empty the ID will be used(page slug).\n\n* **'page_title'**\u003cbr /\u003e\n\tDefault: `''`. The text to be displayed in the title tags of the page when the menu is selected. If empty 'menu_title' is used \n\n* **'parent_slug'**\u003cbr /\u003e\n\tDefault: `null`.  If is 'null', the page will not be added to menu. If 'false', will be a parent page(menu). Else, subpage(submenu).\n\n* **'capability'**\u003cbr /\u003e\n\tDefault: `'manage_options'`.  Who can access the page. See: https://codex.wordpress.org/Roles_and_Capabilities\n\n* **'menu_icon'**\u003cbr /\u003e\n\tDefault: `''`. The icon for this menu. Only if 'menu_type' is 'menu'. https://codex.wordpress.org/Function_Reference/add_menu_page#Parameters\n\n* **'menu_position'**\u003cbr /\u003e\n\tDefault: `null`. The position in the menu order this menu should appear. https://codex.wordpress.org/Function_Reference/add_menu_page#Parameters\n\n* **'default_tab_label'**\u003cbr /\u003e\n\tDefault: `''`.  Default tab label. Setting this, will change the title of default tab(first tab), else will use the 'menu_title'.\n\n###All available settings for tabs: `ZeroWP\\Admin\\Tab`\n\nAll settings are optional. Use only that you need.\n\n```php\npublic function settings(){\n\treturn array(\n\t\t'label'    =\u003e '',\n\t);\n}\n```\n\n* **'label'**\u003cbr\u003e\n\tDefault: `''`. The tab title. If empty the ID will be used(tab slug).\n\n###Add scripts and styles\n\n`enqueue()`. This method allows to enqueue scripts and styles only on the page that you've created. The scripts and styles will be available in all other tabs that you'll create. This method is also available in `ZeroWP\\Admin\\Tab` and the rules are the same(the scripts/styles will be available in all other tabs and parent page).\n\nHere is a basic example:\n```php\npublic function enqueue(){\n\twp_register_style( 'example-css', 'example.css' );\n\twp_enqueue_style( 'example-css' );\n\n\twp_register_script( 'example-js', 'example.js' );\n\twp_enqueue_script( 'example-js' );\n}\n```\n\n###Using in plugins:\n\nThis piece of code can be included in plugins as it is and will work without problems, but it is recomended to replace the namespace `ZeroWP` with your own. Doing so you'll avoid conflicts with other plugins that are using this code as well.\u003cbr\u003e\nJust do a global search\u0026replace in your favorite text editor and you're done!\u003cbr\u003e\nHappy coding.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawps%2Fadminpage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawps%2Fadminpage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawps%2Fadminpage/lists"}