douxiangshi6568 2016-04-09 19:08
浏览 971

如何从WordPress中的页面模板中删除页眉和页脚,但保持样式

I've just created a new page template in WordPress, starting from the default code in page.php. For the new template, I want to remove the footer and header information (logo, menu, etc), while keeping all the other properties of the default template. How can I do this?

When I remove

<?php get_footer(); ?>

from the new template, the footer disappears, which is okay, I guess.

But when I remove

<?php get_header(); get_template_part('templates/page', 'header'); ?>

all the styling disappears together with the header. Plus I'm left with a padding all around the page and the page name is gone too. How can I remove the header and the padding while keeping the old styling?

Thanks!

  • 写回答

1条回答 默认 最新

  • dtlc84438 2016-04-09 19:39
    关注

    You can create new header and footer files, say "header-mytemplate.php" and "footer-mytemplate.php". Create what ever structure you want into it. And in your new tempalte call these header and footer, like this get_header('mytemplate'); and get_footer(mytemplate);.

    This will get the newly created header and footer. You can customize these header and footer files as you like.

    Hope this helps.

    评论

报告相同问题?

悬赏问题

  • ¥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添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?