Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Force inclusion of widgets in Wordpress

Featured Replies

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?

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?

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 by notbanksy

  • 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

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.