admin管理员组文章数量:1426918
I'm looking for a way to have a post template that has two sidebars, one on the right side, the other on the left side, with always the same content on each one of them.
I defined that left sidebar as "sidebaraleatorio", and right sidebar as "sidebarrecomenda", and created for each one of them a .php file, then I registered them in my functions.php of child theme. After that, I created a template trying to call the two sidebars php files:
<?php get_sidebaraleatorio(); ?>
<?php get_sidebarrecomenda(); ?>
But when I tested, there were several bugs, so I guess something is wrong in my way of doing it... Shouldn't I create different sidebar php files?
If the problem is not that, I can include the other code I'm using on these files
Thanks a lot for any help
I'm looking for a way to have a post template that has two sidebars, one on the right side, the other on the left side, with always the same content on each one of them.
I defined that left sidebar as "sidebaraleatorio", and right sidebar as "sidebarrecomenda", and created for each one of them a .php file, then I registered them in my functions.php of child theme. After that, I created a template trying to call the two sidebars php files:
<?php get_sidebaraleatorio(); ?>
<?php get_sidebarrecomenda(); ?>
But when I tested, there were several bugs, so I guess something is wrong in my way of doing it... Shouldn't I create different sidebar php files?
If the problem is not that, I can include the other code I'm using on these files
Thanks a lot for any help
Share Improve this question asked May 22, 2019 at 17:17 usinausina 133 bronze badges1 Answer
Reset to default 2If you add sidebar-sidebaraleatorio.php
and sidebar-sidebarrecomenda.php
sidebar templates to your (child) theme directory, you can then call them with get_sidebar()
function.
Like so get_sidebar('sidebaraleatorio);
and get_sidebar('sidebarrecomenda);
.
You can read more about sidebars from the Developer Handbook > Sidebars.
本文标签: How to create a post template with two sidebars
版权声明:本文标题:How to create a post template with two sidebars 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745472679a2659821.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论