0

I know get_sidebar( ); is used to get the widget sidebar , but how do I request one element from it?

For instance, if I want to show the search or most read only? I know there is a way to specify the sidebar for page like get_sidebar('404' ); for example

How do I do this? I've created the 404.php page. Do I have to register other sidebar or do I have to create "404_sidebar.php"?

So, how do I get the "search" element only when my website return error 404?

1
  • @Pieter Goosen thanx
    – Hadi Omary
    Aug 13, 2014 at 13:24

1 Answer 1

1

You can include the search form in your 404.php file using the get_search_form() function.

Using get_sidebar( '404' ); would look for a file called sidebar-404.php and fall back on sidebar.php if needed. get_sidebar()

3
  • شــــكراً.... thanx .... it work
    – Hadi Omary
    Aug 13, 2014 at 11:33
  • عفواً (did I do that right?) Aug 13, 2014 at 11:39
  • actually i don't know this 'get_search_form()' i put it in the '404.php' and style it again..... yes you did ... i think you are Arabic lol
    – Hadi Omary
    Aug 13, 2014 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.