繁体   English   中英

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

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

main.page模板文件中几乎没有HTML。 这是非常不确定的,我无法编辑单个元素并准确地更改我的网页。 我可以删除整个标头之类的东西,但是我看到了其他主题,这些主题具有包含大多数页面结构的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' ); ?>">

您正在使用的文件用于Displays all of the <head> section and everything up till <div id="content">这是您要编辑的其他主题文件。 示例templates/header/header-layout-one等等,您可能首先想使用一个简单的主题,但首先请按照以下说明将主题变成子主题:https://codex.wordpress.org/Child_Themes以免破坏网站或丢失更新更改,然后可以开始编辑主题以适合您的需求。

请务必阅读

我怎么问一个好问题? https://stackoverflow.com/help/how-to-ask

暂无
暂无

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

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