简体   繁体   English

为什么我无法在Wordpress主题的PHP模板文件中编辑HTML

[英]Why can't I edit HTML in my Wordpress theme's PHP template files

There is barely any HTML in the main page.php template file. main.page模板文件中几乎没有HTML。 It's very unspecific and I can't edit individual elements and alter my webpage accurately. 这是非常不确定的,我无法编辑单个元素并准确地更改我的网页。 I'm able to delete things like entire headers, but I've seen other themes that have PHP template files that include most of the page structure, which gave me fine control over the web page. 我可以删除整个标头之类的东西,但是我看到了其他主题,这些主题具有包含大多数页面结构的PHP模板文件,这使我可以更好地控制网页。

<?php
/**
 * The header for our theme.
 *
 * Displays all of the <head> section and everything up till <div id="content">
 *
 * @package Nikkon
 */
global $woocommerce;
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">

<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

<div id="page" class="hfeed site <?php echo sanitize_html_class( get_theme_mod( 'nikkon-slider-type' ) ); ?>">

<?php echo ( get_theme_mod( 'nikkon-site-layout' ) == 'nikkon-site-boxed' ) ? '<div class="site-boxed">' : ''; ?>

    <?php if ( get_theme_mod( 'nikkon-header-layout' ) == 'nikkon-header-layout-three' ) : ?>

        <?php get_template_part( '/templates/header/header-layout-three' ); ?>

    <?php else : ?>

        <?php get_template_part( '/templates/header/header-layout-one' ); ?>

    <?php endif; ?>

    <?php if ( is_front_page() ) : ?>

        <?php get_template_part( '/templates/slider/homepage-slider' ); ?>

    <?php endif; ?>

    <div class="site-container <?php echo ( ! is_active_sidebar( 'sidebar-1' ) ) ? sanitize_html_class( 'content-no-sidebar' ) : sanitize_html_class( 'content-has-sidebar' ); ?>">

The file you are working in Is for Displays all of the <head> section and everything up till <div id="content"> It is the other theme files you want to be editing. 您正在使用的文件用于Displays all of the <head> section and everything up till <div id="content">这是您要编辑的其他主题文件。 example templates/header/header-layout-one and so on you might want to play around with a simpler theme first But start off with making your theme into a child theme follow the instructions here https://codex.wordpress.org/Child_Themes as to not break site or lose changes on update and then you can start editing the theme to suite your needs. 示例templates/header/header-layout-one等等,您可能首先想使用一个简单的主题,但首先请按照以下说明将主题变成子主题:https://codex.wordpress.org/Child_Themes以免破坏网站或丢失更新更改,然后可以开始编辑主题以适合您的需求。

Be sure to read 请务必阅读

How do I ask a good question? 我怎么问一个好问题? https://stackoverflow.com/help/how-to-ask https://stackoverflow.com/help/how-to-ask

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM