最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

theme development - How to have different headers.php files based on the display page

programmeradmin5浏览0评论

With the get_header() function, if I have an header.php and an header-news.php, can I use the second file only when a single post of the nesw category is displayed? I have a one page wordpress website where the only page will be the news category archive and the sigle news categorized posts that are using the single.php file template. The menu links are anchor tags so if the user navigate away from home by clicking on a news, I need that the menu can redirect it back to the home where all the contents are published. Also I need some suggestion on how to paginate my category archive. Thanks in advance.

With the get_header() function, if I have an header.php and an header-news.php, can I use the second file only when a single post of the nesw category is displayed? I have a one page wordpress website where the only page will be the news category archive and the sigle news categorized posts that are using the single.php file template. The menu links are anchor tags so if the user navigate away from home by clicking on a news, I need that the menu can redirect it back to the home where all the contents are published. Also I need some suggestion on how to paginate my category archive. Thanks in advance.

Share Improve this question asked May 5, 2020 at 13:30 sialfasialfa 32910 silver badges29 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Please try this header in single.php

<?php get_header('news'); ?>

let me know if still facing the issue.

发布评论

评论列表(0)

  1. 暂无评论