November 7, 201214 yr Hey, im nearly done making a theme for Wordpress and as part of the design, I have a search bar at the top of the page. When I zip the theme up and load it onto a test version of Wordpress, the search bar isnt at the top of the page at all until I put it there. Is there a way to force it to stay there?
November 13, 201214 yr Where about's exactly is the search bar? Actually within your sidebar/widgets or in the header somewhere? If it's in the header do you have anything like this: <?php get_search_form(); ?> Do you have a link to the theme/demo?
November 13, 201214 yr Have a look at the default wordpress themes and you'll see how it's done. I can't remember the syntax off the top of my head, but the page.php (or is it sidebar.php?) file has some code in it which basically says: <?php if dynamic_sidebar() {sidebar code here} else {get_search_form()}; ?> Edited November 13, 201214 yr by notbanksy
November 15, 201214 yr Author Thanks for the help guys. I'm can't actually look at the code until later so I will try it then. The way that I am doing it at he moment is use a widget area with a search bar inside it. Then I use dynamic sidecar to output it. And that is at the very top of the page. How do I force the widgets regardless of wether it is a search bar, text box etc to stay there when I zip up the theme, so that it is there when it's loaded as a theme somewhere else? Thanks for the help
November 15, 201214 yr You can't force widgets, but you can provide the same effect by doing what !b said - provide the widgets as a static alternative for when the sidebar's empty (which it will be on theme activation).
Create an account or sign in to comment