WordPress.org

Make WordPress Core

Changeset 45608


Ignore:
Timestamp:
07/08/2019 03:14:37 AM (2 years ago)
Author:
pento
Message:

Theme Editor: Hide the recommendation to create a child theme when editing a child theme.

Props mukesh27, davidbaumwald.
Fixes #44889.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/theme-editor.php

    r45583 r45608  
    345345                <p>
    346346                    <?php
    347                     echo sprintf(
    348                         /* translators: %s: link to documentation on child themes */
    349                         __( 'You appear to be making direct edits to your theme in the WordPress dashboard. We recommend that you don&#8217;t! Editing your theme directly could break your site and your changes may be lost in future updates. If you need to tweak more than your theme&#8217;s CSS, you might want to try <a href="%s">making a child theme</a>.' ),
    350                         esc_url( __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ) )
    351                     );
     347                    _e( 'You appear to be making direct edits to your theme in the WordPress dashboard. We recommend that you don&#8217;t! Editing your theme directly could break your site and your changes may be lost in future updates.' );
    352348                    ?>
    353349                </p>
     350                    <?php
     351                    if ( ! $theme->parent() ) {
     352                        echo '<p>';
     353                        echo sprintf(
     354                            /* translators: %s: link to documentation on child themes */
     355                            __( 'If you need to tweak more than your theme&#8217;s CSS, you might want to try <a href="%s">making a child theme</a>.' ),
     356                            esc_url( __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ) )
     357                        );
     358                        echo '</p>';
     359                    }
     360                    ?>
    354361                <p><?php _e( 'If you decide to go ahead with direct edits anyway, use a file manager to create a copy with a new name and hang on to the original. That way, you can re-enable a functional version if something goes wrong.' ); ?></p>
    355362            </div>
Note: See TracChangeset for help on using the changeset viewer.