Reputation: 3297
I'm working on my next Wordpress website for a customer (it's still on localhost so I can't give you a link). I got 4 pages and I need 2 sidebars. So I paste a code into functions.php
for creating 2 sidebars:
<?php
if ( function_exists('register_sidebar') )
{
register_sidebar(array('name' => 'Angebot'));
register_sidebar(array('name' => 'Anfahrt'));
}
?>
In the backend, the 2 sidebars are shown correctly and I can put some text into (I just put some random text for test in the sidebars and nothing else). And then I put some code into index.php
and into page.php
:
<div id="sidebar"> <?php if(is_page('Willkommen') || is_page('Angebot'))
{
get_sidebar('Angebot');
}
else
{
echo "Huhu";
}
?>
</div><!-- sidebar -->
I put the text "Huhu" in the else that I can see if the code works. And it does.
But my problem now is: It takes the sidebar I told it in my code but it doesn't show my text I put into the widget sidebar. It just show the archive
, categories
, pages
etc. And I still don't know why.
Has someone an idea or can someone give me a hint?
Thanks in advance
Cheers
Upvotes: 0
Views: 206
Reputation: 7724
Try replacing this:-
get_sidebar('Angebot');
with this:-
dynamic_sidebar('Angebot');
Upvotes: 1