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

How to create a post template with two sidebars

programmeradmin0浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 2

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

发布评论

评论列表(0)

  1. 暂无评论