:wordpress中一篇文章同时属于两个分类目录,能使这篇文章在不同的分类调用不同的模板吗

WBOY
Release: 2016-06-23 13:33:47
Original
1172 people have browsed it

假如文章同时属于分类A和分类B,在前台分类A和分类B两个页面中都存在一个文章列表,可以实现从分类A列表中点击该文章调用一个模板,从B列表点击文章调用另一个模板吗


回复讨论(解决方案)

模板由分类决定,而不是由文章决定
如果你给每个分类都设置有自己的模板,那当然是可以的

链接地址后多加一个参数class=A|B
目标页再根据class显示对应的模板。
因为你文章同时属于多个类,没有特定的表示,它也不知道该显示哪个类的模板

谢谢提示 ,使用链接传递参数的方式实现了

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!