Added the file types that are visible when the wordpress background is edited.

Source: Internet
Author: User
Everyone knows that when editing a theme in the wordpress background, we can only edit files with css and php suffixes. People like me who love JavaScript always need to change js in the running space, this is really troublesome, so I thought of adding a recognized file type for the topic editing. Next I will introduce how to make js files appear in the wordpress topic editing list. in wp-admintheme

Everyone knows that when editing a theme in the wordpress background, we can only edit files with css and php suffixes. People like me who love JavaScript always need to change js in the running space, this is really troublesome, so I thought of adding a recognized file type for the topic editing. Next I will introduce how to make js files appear in the wordpress topic editing list. in wp-admin/theme

Everyone knows that when editing a theme in the wordpress background, we can only edit files with css and php suffixes. People like me who love JavaScript always need to change js in the running space, this is really troublesome, so I thought of adding a recognized file type for the topic editing. Next I will introduce how to make js files appear in the wordpress topic editing list.
In wp-admin/theme-editor.php, find the following code:

$allowed_files = $theme->get_files( 'php', 1 );$has_templates = ! empty( $allowed_files );$style_files = $theme->get_files( 'css' );$allowed_files['style.css'] = $style_files['style.css'];$allowed_files += $style_files;

In a simple explanation, the Code aims to limit the file types allowed in theme-editor (subject editing). This makes it easy to handle,
Take adding js as an example and change the above Code to the following:

$allowed_files = $theme->get_files( 'php', 1 );$has_templates = ! empty( $allowed_files );$js_files = $theme->get_files( 'js' );$style_files = $theme->get_files( 'css' );$allowed_files['style.css'] = $style_files['style.css'];$allowed_files += $style_files;$allowed_files += $js_files;

On:

Note that only files in the root directory are displayed.

Original article address: added the file type that is visible when the wordpress background is edited. Thank you for sharing it with the original author.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.