dongni3854 2016-12-23 21:44
浏览 49
已采纳

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

There is barely any HTML in the main page.php template file. 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
/**
 * 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' ); ?>">
  • 写回答

1条回答 默认 最新

  • dongshiru5913 2016-12-23 22:02
    关注

    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. 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.

    Be sure to read

    How do I ask a good question? https://stackoverflow.com/help/how-to-ask

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CSS实现渐隐虚线边框
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题