Menambah Search Form di Menu Bar

Ada pertanyaan bagus yang disampaikan oleh Sdr. Andi. yaitu bagaimana memasang form pencarian di menu bar. Sebenarnya ada pertanyaan kedua yaitu bagaimana mengubah tampilan tombolnya.

Tapi di artikel ini saya bahas dulu pertanyaan pertamanya aja dulu ya biar penasaran untuk mengubah tombolnya hehehe.. Dan mas Andi biar sering2 kesini juga 😀

Oke, langsung aja ada 2 file yang kita edit yaitu index.php dan style.css. index.php kita gunakan untuk menentukan letak form-nya dan style.css untuk mengubah style-nya.

Pertama, di file index.php anda cari dulu kode untuk menampilkan menu bar-nya yaitu ini:

<div id="menu">
  <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>

Di bawah wp_nav_menu kita masukkan deh kode form-nya sehingga hasilnya seperti ini:

<div id="menu">
  <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
  <div id="search">
  <form action="<?php bloginfo('url');?>" method="get">
  <input type="text" size="30" name="s"/>
  <input type="submit" value="search"/>

Jika anda menjalankan blog sekarang, maka bisa anda lihat kalau form-nya nempel dengan menu-menu yang diatas. Maka kita perlu memisahkannya dan meletakkanya di sebelah kanan. Untuk itu, kita pasang deh style-nya di file style.css dengan kode berikut:

#search {

Sekarang sebuah form sudah hadir di sebelah kanan deretan menu anda 🙂

Dicari dengan kata kunci:

membuat menu search dengan php,cara membuat search dengan php,search form,search pada php,form pencarian php,cara membuat search di php,cara membuat menu bar di wordpress,form search php,membuat search di website,menu search php

26 thoughts on “Menambah Search Form di Menu Bar

  1. indam

    Permisi mas, sejak wp versi 3 fungsi ini bloginfo('url') sudah tidak direkomendasikan lagi, bahkan ketika WP_DEBUG diganti true, fungsi ini menyebabkan error, sebagai gantinya gunakan echo home_url(). Outputnya sama ‘halaman utama’.

  2. samad dadrana

    wah asyik nih gan maun nanya bagaimana cara membuat footer kayak punya mas lutfi yang empat kolom

    oh iya ijin subscribe yah
    di sini hampir seluruhnya saya butuhkan
    semangat gan!

  3. belajar

    saya pertama kali pake wordpress sama sekali gak ngerti edit”nya om,,semua serba php… di blog ini ternyata panduannya cukup lengkap,,,jadi bagus bisa membimbing ane yg nubi ini sob..thanks…

  4. next

    I just want to tell you that I’m new to blogs and seriously savored your website. Likely I’m likely to bookmark your blog post . You actually come with terrific stories. Cheers for sharing your webpage.

  5. content

    I just want to tell you that I’m very new to blogging and definitely savored this blog site. Most likely I’m planning to bookmark your website . You certainly come with perfect stories. Thank you for revealing your blog site.

  6. Beckie Lesiak

    Hiya, I’m really cheerful I have establish this information. Today bloggers distribute only concerning gossips and internet and this is really frustrating. A sunny position with exciting subject matter, this is what I necessary. Thankfulness for keeping this website, I’ll ensue visiting it. Achieve you do newsletters? Can not find it.

  7. Andrew A. Sailer

    Hands down, Apple’s app store wins by a mile. It’s a huge selection of all sorts of apps vs a rather sad selection of a handful for Zune. Microsoft has plans, especially in the realm of games, but I’m not sure I’d want to bet on the future if this aspect is important to you. The iPod is a much better choice in that case.

  8. Bethany Peick

    Simply want to say your article is as astonishing. The clearness in your submit is just nice and i can think you’re an expert on this subject. Fine with your permission let me to grasp your feed to stay updated with imminent post. Thanks 1,000,000 and please continue the gratifying work.

  9. Vanetta Toyama

    My brother suggested I might like this web site. He was entirely right. This post actually made my day. You can not imagine simply how much time I had spent for this info! Thanks!

  10. Luigi Fulk

    Between me and my husband we’ve owned more MP3 players over the years than I can count, including Sansas, iRivers, iPods (classic & touch), the Ibiza Rhapsody, etc. But, the last few years I’ve settled down to one line of players. Why? Because I was happy to discover how well-designed and fun to use the underappreciated (and widely mocked) Zunes are.

  11. Lonnie Bubb

    Your style is so unique in comparison to other people I have read stuff from. I appreciate you for posting when you’ve got the opportunity, Guess I’ll just bookmark this web site.

  12. Rodrick Kroner

    Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you can do with some pics to drive the message home a bit, but other than that, this is great blog. An excellent read. I’ll certainly be back.

Comments are closed.