programing

WordPress Theme: 독립 실행형 테마 need index.php 파일 ERROR

itmemos 2023. 9. 19. 20:50
반응형

WordPress Theme: 독립 실행형 테마 need index.php 파일 ERROR

- word press -> 테마를 코딩할 때 갑자기 오류가 발생했습니다.

index.php 페이지가 있는데 왜 이런지 이해가 안가요.CSS 스타일시트도 거기에 있습니다.style. css 또한 다음과 같은 코멘트를 가지고 있습니다.

풍격

Theme Name: samirTheme
Author: samir
Author URI: www.wordpress.com
Version: 1.0
Description: This is a cool theme
Template: Test1

폴더 구조는 다음과 같습니다.

enter image description here

워드프레스는 처음입니다.주제가 깨지고 워드프레스에 나타나지 않는 이유에 대해 너무 혼란스럽습니다.무슨 생각 있어요?

솔루션 해결 방법은 실제로 매우 간단합니다.저는 정답에 대한 좋은 자료를 찾는 것이 매우 어렵다는 것을 발견하여 여기에 답을 드립니다.

주석이 달린 헤더에 style.css:template:테마가 없습니다.

/*
 Theme Name:   samirTheme
 Theme URI:    http://example.com/twenty-fifteen-child/
 Description:  Twenty Fifteen Child Theme
 Author:       John Doe
 Author URI:   http://example.com
 Template:     twentyfifteen <--------------------------------------------
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twenty-fifteen-child
*/

WordPress가 테마 템플릿 파일 집합을 유효한 테마로 인식하려면 style.css 파일이 하위 디렉터리가 아니라 테마의 루트 디렉터리에 있어야 합니다.

그래서 메인 테마 css 파일을 root ->에 입력한 다음 모든 스타일을 포함하는 두 번째 스타일 시트를 대기열에 넣습니다. /css/에 입력하려면

CSS의 헤더 예시:

/*
Theme Name: Twenty Seventeen
Theme URI: https://wordpress.org/themes/twentyseventeen/
Author: the WordPress team
Author URI: https://wordpress.org/
Description: Twenty Seventeen brings your site to life with immersive featured images and subtle animations. With a focus on business sites, it features multiple sections on the front page as well as widgets, navigation and social menus, a logo, and more. Personalize its asymmetrical grid with a custom color scheme and showcase your multimedia content with post formats. Our default theme for 2017 works great in many languages, for any abilities, and on any device.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentyseventeen
Tags: one-column, two-columns, right-sidebar, flexible-header, accessibility-ready, custom-colors, custom-header, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/

더 자세한 정보는 이것을 읽어보세요: https://developer.wordpress.org/themes/basics/main-stylesheet-style-css/

저도 마찬가지에요.필요한 모든 파일을 가지고 있습니다.(2개의 파일은 인덱스와 스타일만 필요하므로) style.css 파일의 폴더가 있으면 위와 같은 오류 메시지가 나타납니다.

그래서 교차 확인하고 이동까지 해서 메인 폴더에서 인덱스 파일을 삭제했습니다.

메인 폴더에서 index.php 파일을 삭제하고 css 폴더 안에 넣으면 됩니다.

왜 그런 일이 일어났는지 모르겠습니다.하지만 메인 폴더에 넣을 style 폴더나 style.css 파일 안에 인덱스 파일이 필요한 것 같습니다.

이 오류는 문자 인코딩으로 인해 발생할 수도 있습니다.예를 들어,

$ file -I style.css
style.css: text/plain; charset=us-ascii
$ file -I style-error.css
style-error.css: text/plain; charset=utf-16le

웹 페이지(예: 튜토리얼 기사)의 CSS 코드를 CSS 파일 자체에 복사하여 붙여넣는 것은 이것에 걸려 넘어지는 일반적인 원인입니다.CSS 코드에 특수 문자가 포함되어 있는 경우 파일 편집자는 추가되는 모든 문자에 맞게 CSS 파일의 문자 인코딩을 변경하려고 할 수 있습니다.

이 질문이 나왔을 때 그 사실이 한참 후에, 그러나 그것이 답을 찾고 있는 다른 사람에게 도움이 되기를 바랍니다.

언급URL : https://stackoverflow.com/questions/43300582/wordpress-theme-standalone-theme-need-index-php-file-error

반응형