{"id":20640624,"url":"https://github.com/nash-ye/wp-conditional-themes","last_synced_at":"2025-05-10T07:30:43.243Z","repository":{"id":72024415,"uuid":"13633397","full_name":"nash-ye/wp-conditional-themes","owner":"nash-ye","description":"A simple API to switch the themes on certain conditions.","archived":false,"fork":false,"pushed_at":"2019-07-21T15:17:43.000Z","size":28,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-15T23:02:43.310Z","etag":null,"topics":["wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":"https://wordpress.org/plugins/wp-conditional-themes/","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/nash-ye.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"nash1ye"}},"created_at":"2013-10-16T22:52:05.000Z","updated_at":"2024-04-22T00:51:33.000Z","dependencies_parsed_at":"2023-07-08T08:00:33.649Z","dependency_job_id":null,"html_url":"https://github.com/nash-ye/wp-conditional-themes","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nash-ye%2Fwp-conditional-themes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nash-ye%2Fwp-conditional-themes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nash-ye%2Fwp-conditional-themes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nash-ye%2Fwp-conditional-themes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nash-ye","download_url":"https://codeload.github.com/nash-ye/wp-conditional-themes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253379438,"owners_count":21899253,"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":["wordpress","wordpress-plugin"],"created_at":"2024-11-16T15:30:08.592Z","updated_at":"2025-05-10T07:30:43.237Z","avatar_url":"https://github.com/nash-ye.png","language":"PHP","funding_links":["https://patreon.com/nash1ye"],"categories":[],"sub_categories":[],"readme":"WP Conditional Themes\n=====================\nA simple API to switch the themes on certain conditions.\n\nUsage\n==============\nWrite an another plugin file and use the Conditional Themes API as the example below:\n\n```\nadd_action('plugins_loaded', 'my_conditional_themes_setup', 100);\n\nfunction my_conditional_themes_setup()\n{\n    // Switch to Twenty Eleven theme if the visitor use Internet Explorer.\n    Conditional_Themes_Manager::register('twentyeleven', function() {\n        global $is_IE;\n        return (bool) $is_IE;\n    });\n\n    // Switch to Twenty Thirteen theme if the user has administrator role.\n    Conditional_Themes_Manager::register('twentythirteen', function() {\n        return current_user_can('administrator');\n    });\n\n    // Switch to a custom theme if the visitor use a mobile device.\n    Conditional_Themes_Manager::register('mobile', 'wp_is_mobile');\n}\n```\n\nAnother example, With enabling persistent mode.\n\n```\nadd_action('plugins_loaded', 'my_conditional_themes_setup', 100);\n\nfunction my_conditional_themes_setup()\n{\n    // Enable the switcher persistent mode.\n    Conditional_Themes_Manager::set_option('persistent', true);\n\n    // Switch to Twenty Sixteen theme when we being on 2016.\n    Conditional_Themes_Manager::register('twentysixteen', function() {\n        return (date('Y') == 2016);\n    });\n\n    // Switch to Twenty Fifteen theme when the site reaches 500 post.\n    Conditional_Themes_Manager::register('twentyfifteen', function() {\n        return ((int) wp_count_posts() \u003e 500);\n    });\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnash-ye%2Fwp-conditional-themes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnash-ye%2Fwp-conditional-themes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnash-ye%2Fwp-conditional-themes/lists"}