• sdcr

    (@solidcolour)


    This is php question really.
    I can put <?php include (TEMPLATEPATH . ‘/searchform.php’); ?> into any template, but how can i put it into “here”? <?php else : here endif; ?>

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • <?php else: include(TEMPLATEPATH . '/searchform.php'); ?>

    is this ok?

    Thread Starter sdcr

    (@solidcolour)

    yes it works, i was thinking that as well just want to make sure.

    thanks

    The “correct” method is to use <?php get_search_form();?>,

    Thread Starter sdcr

    (@solidcolour)

    you are right esmi, but we may want to custom it for the styling.

    How does that affect using the correct WP function/tag? Just create your own searchform.php template file, add it to your theme and <?php get_search_form();?> will call it automatically. I’ve not created a theme yet that uses the default search form.

    Thread Starter sdcr

    (@solidcolour)

    thnanks esmi, that was beautiful!

    Thread Starter sdcr

    (@solidcolour)

    Here I found another issue:

    What if the <?php get_search_form();?> has been used 2 times on a page (e.g. the hform not only in sidebar but also in main content in 404.php)

    So, there will be problems with the ID tags, W3C doesn’t allow using a same ID name more than 1 time on a page.

    I can copy the code from searchform.php and give some new ID names but it’s not so convenient if add it to few pages.

    Any better solution please?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘how to include searchform.php’ is closed to new replies.