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.