문제

I'd like to restrict a child theme to only being visible to me, the admin, for development purposes. Then I can make changes, upload and view them live and on the site without other people seeing those unfinished changes. Once I'm done, I take the affected files and move them to the Parent Theme's folder to make the changes visible to everyone.

Is this possible with some kind of script through functions.php?

도움이 되었습니까?

해결책

You would probably want to create a development environment on a subdomain, but if you are restricted by this, you will want to enqueue the style only when you are logged in.

In style.css (change twenty fourteen to match your current theme)

/*
Theme Name:   Twenty Fourteen Child
Theme URI:    http://example.com/twenty-fourteen-child/
Template:     twentyfourteen
*/

@import url("../twentyfourteen/style.css");

In header.php

if ( is_user_logged_in() ) {
    if ( $user_id = YOUR_USER_ID ) {
        wp_register_style('YOUR_STYLE', get_stylesheet_directory_uri() . 'PATH.css');
        wp_enqueue_style('YOUR_STYLE');
    }
}

This should be the general idea of what you want to do. Comment if you have any questions.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top