[Resolved] problem with widgets
Hi, I recently updated to 2.2 and want to use the widget feature. But I still got a few problems, which I cant work out.
My search box in the sidebar is not recognized correctly by the widget-thingy.
The code in the sidebar.php is:
<li id="search"> <h2><label for="s"><?php _e('Search:'); ?></label></h2> <ul> <li> <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <div style="text-align:center"> <input type="text" name="s" id="s" size="15" /> <input type="submit" name="submit" value="<?php _e('Search'); ?>" /> </div> </form> </li> </ul> </li>
But is displayed as
<li id="search" class="widget widget_search"> <form id="searchform" method="get" action="http://www.moeboll.de"> <div> <input name="s" id="s" size="15" type="text"><br> <input value="Suchen" type="submit"> </div> </form> </li>
Why does the widget tool ignore the first li and the following to lines of code, and their close-tags at the end respectevly? Why is the form code changed as well?
You’ll want to review how to widgetize a theme at http://automattic.com/code/widgets/themes/.
Also use the WordPress Default 1.6 theme in 2.2 for examples.
I know the page, I tried to solve the problem with the info from it, but well, didnt work. Ok, I’m not that good with code, but isnt the search-box code exactly the way the widget tool wants it?
It’s got a li with id=”search” – what more is needed to be properly recognized? The rest of the sidebar is tagged the same way, and works fine. Is there anything in the code that messes the whole thing up? And why does the widget tool change the code in the form?
I cant spot the error in the code.
Why does the widget tool ignore
Widgets completely replace your sidebar. Nothing you do in the sidebar.php file will affect the output of the page anymore, the widgets replace the sidebar. That’s the whole point of widgets, so that you don’t have to mess with hand editing sidebars anymore.
Go to Presentation->Sidebar widgets and configure them there. And if you want to change their styling, do it in the CSS file, not directly.
Ah, now I got it. I’ll just add the messed up widgets manualy. Thanks for your help!
- The topic ‘[Resolved] problem with widgets’ is closed to new replies.