이 플러그인은 최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다. 워드프레스의 좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 있을 수 있습니다.

Conditional Themes

설명

Conditional Themes is an API to switch the themes on certain conditions.

Usage

Write an another plugin file and use the Conditional Themes API as the example below:

add_action('plugins_loaded', 'my_conditional_themes_setup', 100);

function my_conditional_themes_setup()
{
    // Switch to Twenty Eleven theme if the visitor use Internet Explorer.
    Conditional_Themes_Manager::register('twentyeleven', function() {
        global $is_IE;
        return (bool) $is_IE;
    });

    // Switch to Twenty Thirteen theme if the user has administrator role.
    Conditional_Themes_Manager::register('twentythirteen', function() {
        return current_user_can('administrator');
    });

    // Switch to a custom theme if the visitor use a mobile device.
    Conditional_Themes_Manager::register('mobile', 'wp_is_mobile');
}

Another example, With enabling persistent mode.

add_action('plugins_loaded', 'my_conditional_themes_setup', 100);

function my_conditional_themes_setup()
{
    // Enable the switcher persistent mode.
    Conditional_Themes_Manager::set_option('persistent', true);

    // Switch to Twenty Sixteen theme when we being on 2016.
    Conditional_Themes_Manager::register('twentysixteen', function() {
        return (date('Y') == 2016);
    });

    // Switch to Twenty Fifteen theme when the site reaches 500 post.
    Conditional_Themes_Manager::register('twentyfifteen', function() {
        return ((int) wp_count_posts() > 500);
    });
}

Note: You can use Code Snippets plugin to add the code snippets to your site.

Contributing

Developers can contribute to the source code on the Github Repository.

설치

  1. Upload and install the plugin
  2. Use the plugin API to powerful your project.

후기

2018년 12월 6일
Petit plugin très sympa pour programmer des changements de thème à l'avance. Pour moi changement de thème pour Noël
모든 10 평가 읽기

기여자 & 개발자

“Conditional Themes”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

자국어로 “Conditional Themes”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.

변경이력

0.6

  • Better code style formatting.

0.4

  • Fix updating switched theme sidebars widgets bug, props @Offereins.
  • Better classes and code organization.

0.4

  • Fix the switched theme sidebars widgets bug, props @joyously.
  • Better functions names and code organization.

0.3

  • Add a new feature allow to switch the themes persistently.
  • Improve the performance by excluding the original theme from being switched.

0.2

  • Cleaner code and minor fixes.

0.1

  • The Initial version.