Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Kupası
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPress’te Arama Geçiş Efekti Nasıl Eklenir

Editoryal Not: WPBeginner üzerindeki ortak bağlantılardan komisyon kazanıyoruz. Komisyonlar, editörlerimizin görüşlerini veya değerlendirmelerini etkilemez. Editoryal Süreç hakkında daha fazla bilgi edinin.

WordPress’te bir arama geçiş efekti eklemek ister misiniz?

Arama geçiş efekti, form yerine bir arama simgesi görüntülemenizi sağlar. Simgeye tıklandığında, arama formu ince bir kayma animasyonuyla görüntülenir.

Bu makalede, WordPress’te arama geçiş efektini nasıl kolayca ekleyebileceğinizi göstereceğiz.

Adding search toggle effect in WordPress

WordPress’te Arama Geçiş Efekti Nedir?

Arama geçiş efekti, bir WordPress web sitesinde arama deneyimini iyileştirmek için kullanılan bir web tasarım tekniğidir.

Bir arama formu görüntülemek yerine, bir arama simgesi görüntüleyeceksiniz. Bir kullanıcı bu simgeye tıkladığında, arama formu bir kayma animasyonuyla birlikte görünür.

Search toggle example

Varsayılan WordPress arama formu pek iyi görünmüyor. Birçok üst düzey WordPress teması zaten varsayılan formu kendi stilleriyle değiştiriyor.

Bununla birlikte, temanız hala statik, düz bir arama formu kullanıyorsa, daha kullanıcı dostu hale getirmek için bu öğreticiyi kullanabilirsiniz.

Bununla birlikte, WordPress’te arama geçiş efektinin nasıl kolayca ekleneceğine bakalım.

Not: Bu eğitim orta ve ileri düzey kullanıcılar içindir çünkü HTML/CSS hakkında temel bilgi sahibi olmayı gerektirir.

WordPress’te Arama Geçiş Efekti Ekleme

WordPress’te bir arama geçiş efekti eklemek için web sitenize bir arama formu bloğu veya widget’ı yerleştirmeniz ve ardından bazı özel CSS kodları eklemeniz gerekir.

Öncelikle, web sitenize bir arama formu eklendiğinden emin olmanız gerekir.

Tam Site Düzenlemesi ile Blok Temaya Arama Formu Ekleme

Tam site düzenleme özelliğine sahip daha yeni bir WordPress blok teması kullanıyorsanız, arama formunu web sitenize bu şekilde ekleyeceksiniz.

Basitçe Görünüm ” Düzenleyici sayfasını ziyaret edin. Düzenleme ekranında, arama formunu görüntülemek istediğiniz yere ‘Arama’ bloğunu ekleyin.

Add search form block

Bundan sonra, değişikliklerinizi kaydetmek için ‘Kaydet’ düğmesine tıklamayı unutmayın.

Diğer WordPress Temalarına Arama Formu Ekleme

Tam site düzenleme özelliği olmayan WordPress temaları için, arama bloğunu veya widget’ını kenar çubuğunuza veya widget’a hazır herhangi bir alana ekleyebilirsiniz.

Görünüm ” Widget ‘lar sayfasına gidin ve arama formunu görüntülemek istediğiniz kenar çubuğuna ‘Arama’ bloğunu/widget’ını ekleyin.

Add search widget to a sidebar

Ardından, arama simgesi için şeffaf bir görüntü bulmanız gerekir.

Bu eğitim için bu görseli kullanacağız. Koyu arka planlar için uygundur (web sitenizde kullanmaktan çekinmeyin).

Kendi arama simgenizi yapmanız gerekiyorsa, boyutları 50×50 pikselden fazla olmayan şeffaf bir PNG görüntüsü oluşturmanız harika olur.

Resim simgesine sahip olduğunuzda, bunu web sitenize yüklemeniz gerekir. Medya ” Yeni Ekle sayfasına gidin ve arama simgesi resminizi yükleyin.

Upload search icon

Yüklendikten sonra, ‘URL’yi panoya kopyala’ düğmesine tıklayın ve ardından bu URL’yi Notepad veya TextEdit gibi bir düz metin düzenleyicisine yapıştırın.

Artık her şey yerli yerinde olduğuna göre, WordPress web sitenize bazı özel CSS’ler eklemeniz gerekir.

Bu eğitimin amacı doğrultusunda, özel CSS’nizi kaydetmek için WPCode eklentisini kullanmanızı öneririz.

WPCode, WordPress‘e kolayca özel kod parçacıkları eklemenizi sağlar. Kullanımı kolaydır ve kodunuz tema güncellemelerinden veya farklı bir temaya geçtiğinizde etkilenmez.

Öncelikle, ücretsiz WPCode eklentisini yüklemeniz ve etkinleştirmeniz gerekir. Daha fazla ayrıntı için, WordPress eklentisinin nasıl kurulacağına ilişkin adım adım kılavuzumuza bakın.

Etkinleştirmenin ardından, WordPress yönetici panonuzdaki Kod Parçacıkları sayfasını ziyaret etmeniz gerekir. Ardından, üstteki ‘Yeni Ekle’ düğmesine tıklamanız yeterlidir.

Add new snippet

Bir sonraki ekranda, öncelikle bu kod parçacığı için bir başlık sağlamanız gerekir. Bu kod parçacığını tanımlamanıza yardımcı olacak herhangi bir şey olabilir.

Bundan sonra, ‘Kod Türü’nü ‘HTML Snippet’ olarak değiştirin. Özel CSS’mizi HTML kullanarak web sitesi başlığına yükleyeceğiz.

Adding snippet

Şimdi, aşağıdaki kodu ‘Kod Önizleme’ kutusuna yapıştırmanız gerekir.

<style type="text/css">
.wp-block-search__inside-wrapper  
.wp-block-search__input {
background-color: transparent;
background-image: url(/url/to/search-icon.png);
background-position: 5px center;
background-repeat: no-repeat;
background-size: 24px 24px;
border: none;
cursor: pointer;
height: 37px;
margin: 3px 0;
padding: 0 0 0 34px;
position: relative;
-webkit-transition: width 400ms ease, background 400ms ease;
transition: width 400ms ease, background 400ms ease;
width: 0;
}
 
.wp-block-search__inside-wrapper  
.wp-block-search__input:focus {
background-color: #fff;
border: 2px solid #c3c0ab;
cursor: text;
outline: 0;
width: 230px;
}
.search-form
.search-submit { 
display:none;
}
</style>

Önemli: /url/to/search-icon.png yerine daha önce kopyaladığınız resim URL’sini koymayı unutmayın.

Bundan sonra, Etkin Değil geçişini ‘Etkin’ olarak değiştirmeniz ve ardından ‘Snippet’i Kaydet’ düğmesine tıklamanız gerekir.

Activate and save snippet

Artık web sitenizi ziyaret ederek geçiş efektli arama formunuzu çalışırken görebilirsiniz.

Search toggle effect in action on a WordPress block theme

Arama Formu Geçiş Etkisi Sorunlarını Giderme

Yukarıdaki yöntem, widget blokları kullanan çoğu modern WordPress temasıyla çalışacaktır.

Ancak bazı temalar için bu yöntem işe yaramayabilir.

WordPress temanızdaki arama formu wp-block-search__inside-wrapper ve wp-block-search__input sınıflarına sahip değilse bu durum meydana gelebilir.

Bu durumda, WordPress temanız tarafından hangi CSS sınıflarının kullanıldığını bulmak için denetleme aracını kullanmanız gerekecektir.

Örneğin, aşağıdaki ekran görüntüsünde, demo temamız arama formu için bu CSS sınıflarını kullanmaktadır.

Finding CSS classes

Şimdi, aşağıdaki kodu değiştirebilir ve bunun yerine bu CSS sınıflarını kullanabilirsiniz. İşte bir örnek.

<style type="text/css"> 
.search-wrap input.s  {
    background-color: transparent;
    background-image: url(/url/to/search-icon.png);
    background-position: 5px center;
    background-repeat: no-repeat;
    background-size: 24px 24px;
    border: none;
    cursor: pointer;
    height: 37px;
    margin: 3px 0;
    padding: 0 0 0 34px;
    position: relative;
    -webkit-transition: width 400ms ease, background 400ms ease;
    transition:         width 400ms ease, background 400ms ease;
    width: 0;
}
 
.search-wrap input.s:focus {
    background-color: #fff;
    border: 2px solid #c3c0ab;
    cursor: text;
    outline: 0;
    width: 230px;
}
.search-form
.search-submit { 
display:none;
}
</style>

İşte test web sitemizde nasıl göründüğü.

Search toggle with classic search widget

Bonus İpucu: Web Siteniz İçin Daha İyi Bir WordPress Araması Ekleyin

Geçiş efekti yalnızca WordPress arama formunuzun güzel görünmesini sağlar. Web sitenizdeki arama sonuçlarının kalitesini etkilemez.

WordPress varsayılan olarak çok temel bir arama özelliği ile birlikte gelir. Bu arama özelliği yavaş, hatalı ve genellikle boş sonuçlar gösteriyor.

İşte SearchWP burada devreye giriyor.

Piyasadaki en iyi WordPress arama eklentisidir ve varsayılan arama özelliğini güçlü bir arama motoruyla kolayca değiştirmenize olanak tanır.

SearchWP Homepage

SearchWP arama formlarını otomatik olarak değiştirir, böylece herhangi bir tema dosyasını düzenlemenize gerek kalmaz. Web sitenizin her yerinde eşleşmeleri arar ve arama sonuçlarının kalitesini büyük ölçüde artırır.

Ayrıca, kullanıcılar sorgularını yazarken sonuçları anında görüntülemek için bir canlı arama uzantısı ile birlikte gelir. Ayrıca, çevrimiçi mağazanızda akıllı bir WooCommerce arama deneyimi oluşturmanıza olanak tanıyan tam e-ticaret desteğine sahiptir.

Umarız bu makale WordPress’te arama geçiş efektinin nasıl ekleneceğini öğrenmenize yardımcı olmuştur. Ayrıca WordPress dönüşüm izleme kılavuzumuzu görmek veya sitenizdeki en popüler gönderileri nasıl bulacağınızı öğrenmek isteyebilirsiniz.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Açıklama: İçeriğimiz okuyucu desteklidir. Bu, bazı bağlantılarımıza tıklarsanız komisyon kazanabileceğimiz anlamına gelir. WPBeginner'ın nasıl finanse edildiğini, neden önemli olduğunu ve nasıl destek olabileceğinizi görün. İşte editoryal sürecimiz.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Ultimate WordPress Araç Kiti

Araç setimize ÜCRETSİZ erişim sağlayın - her profesyonelin sahip olması gereken WordPress ile ilgili ürün ve kaynaklardan oluşan bir koleksiyon!

Reader Interactions

37 yorumBir Cevap Bırakın

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Osh says

    Hi,

    I’m using a child theme, should i add those codes to the parent theme’s files?

    I tried to do that and it is not working, please help !!!

    Thanks

  3. Benjamin Rutledge says

    Is it possible to implement this only on mobile? My theme has a nice animated search function on desktop, but only a toggle to show/hide search box in place of my logo on mobile.

  4. Beth Terry says

    Hi. Thank you very much for this code. I did have to play around with the positioning to get the search button to appear where I want it, and since I only wanted it to appear in the mobile version, I also added css to the media query for over 800px screens to show the full search field instead of the icon. I got it working great, but I do think it’s a little complicated for folks who just want something to basically plug and play.

    You can view the results here:

    To everyone who doubts, javascript is definitely not needed.

    • Beth Terry says

      Also, I want to add that I am using a Twenty Twelve child theme, which comes with the HTML4 search code. Adding the HTML5 support to the functions.php did not fix it, so I copied and pasted the HTML5 search code that you posted above into my theme header where I wanted to search box to be.

  5. Emily G says

    Hi there – implementing this on a website and would like to use FontAwesome instead of an image. I cannot get the icon to show yup, however. Do you have any tips? I am adding the font and icon font-family: FontAwesome;
    content: “\f002″; to the .search-form input[type=”search”]

    Thanks!

  6. Steve says

    I was so hoping this would work for me. I pasted in the code in the Additional CSS area of my theme (twentytwelvechild), added the search-icon.png to my theme folder using FTM and added add_theme_support(‘html5’, array(‘search-form’)); to my theme’s functions.php file. I see no change and wonder what I have missed. I hope someone can offer me a clue. thank you.

  7. Crowd says

    Thank you very much, works like a charm.
    Do you think there’s a way to make the search field appear from right to left (unlike from left to right like now)?

  8. Cassy says

    I got this working on genesis but my search form is in my nav bar, and when the screen width is relatively too small, the search form moves down.

    • Cassy says

      I got it working on Genesis. You have to move the search-icon.png into your genesis child theme images folder. Then, depending on where you put your search form, mine is in the nav bar so it is slightly different, you adjust the css style to your likes. I had to modify the “.genesis-nav-menu .search input” class to get it working.

      • Laura says

        Hi Cassy, Can you give a little more info on how you modified the .genesis-nav-menu .search input class? I can’t seem to get it working. Thanks!

    • Anur says

      yea the same problem im on genesis with enteprise pro theme doesnt work.
      Anyone who has solution to make this work on genesis..

  9. Roy says

    this is really great! Is it possible to get the icon to sit static at the right while the form slides out to the left? I can’t seem to figure it out!

  10. Joshua Farr says

    Greetings – Thank you for this great bit of code. I’ve tried inserting it into a client’s site that I’m working, using the HTML5 version of the code, I placed the extra bit into functions.php and added all of the css. I put in a search icon and got the form to show up how I want on the site – it will even do all of the toggle-ing effect as desired – but when I enter text that I want to search to test it out, I can not submit the search to view search results. We are using a woocommerce theme, “Mystile”, which has a default search form (which works when entered) but I much prefer the looks and functionality of the form as mentioned on this page.

    We tried putting the wocommerce search form code side by side with the code you gave above, tried swapping out bits and pieces to “merge” the two…but no luck.

    Any reccomendations would be extremely helpful.
    Thank you!
    -Josh

  11. Rajeesh Nair says

    Now that’s some interesting stuff there. Though I am a mere beginner and I actually use the search option that has come default with the blog theme which is like a pop-up (not exactly a pop-up though as its CSS and not javascript) and displays search bar.

    But what I am exactly looking for is that how to display Google Search along with Blog search as found in popular blogs like ListVerse and others. Please guide me through this!

  12. alexisnicholson says

    Code looks fabulous , I appreciate your efforts , surely gonna try this one for my word press project .

    Codingbrains

  13. Shahraar Khan says

    A demo would be helpful.. Also what does the use of role=”search” attribute in the form tag, what is the attribute “role” used for?

  14. Susan Silver says

    I have been looking for a simple tutorial on this. Thanks! Have you done one yet on the sliding menus like those on the Facebook mobile app? These menus are becoming very popular, even for desktop apps.

Bir Cevap Bırakın

Yorum bırakmayı seçtiğiniz için teşekkür ederiz. Lütfen tüm yorumların yorum poli̇ti̇kasi uyarınca denetlendiğini ve e-posta adresinizin yayımlanmayacağını unutmayın. Ad alanında anahtar kelime KULLANMAYIN. Kişisel ve anlamlı bir sohbet edelim.