You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**MU plugin** per WordPress che trasforma il widget di ricerca del blog in una **ricerca AJAX live**, senza cambiare il markup del tema.
3
+
**MU plugin** per WordPress che trasforma il classico _widget di ricerca del blog_ in una **ricerca AJAX live**, senza modificare il markup del tema.
4
4
5
-
Pensato per essere drop in in`wp-content / mu-plugins`, con codice organizzato sotto`codecorn / ajax-blog-search` e un piccolo bootstrap che registra hook e asset.
5
+
Pensato per essere “drop-in” dentro`wp-content/mu-plugins`, con codice strutturato in`codecorn/ajax-blog-search` e un bootstrap minimale che registra hook e asset.
6
6
7
7
---
8
8
9
-
## Caratteristiche
9
+
## 🚀 Caratteristiche principali
10
10
11
-
- Ricerca **AJAX** sui post del blog direttamente dal widget `widget_search`
12
-
- Nessuna modifica al template del tema : il form rimane quello standard
13
-
- Risultati mostrati **sotto al campo di ricerca** , con titolo , data ed excerpt
14
-
- Fallback automatico :
15
-
- se JS non è disponibile → il form continua a funzionare in modo classico
16
-
- Struttura pulita :
17
-
- bootstrap MU in `mu-cc-ajax-blog-search.php`
18
-
- core in `codecorn / ajax-blog-search / src / Plugin.php`
19
-
- JS e CSS sotto `assets /`
20
-
- Namespace dedicato `CodeCorn \ AjaxBlogSearch`
11
+
- 🔍 Ricerca **AJAX** sui post del blog direttamente dal widget `widget_search`
12
+
- 🧩 Nessuna modifica al template del tema → il form rimane quello standard
13
+
- 💬 Risultati mostrati sotto il campo di ricerca, con titolo, data ed excerpt
14
+
- ⚙️ Fallback automatico: se JS è disattivo, il form continua a funzionare in modo classico
Assicurati che il file `mu-cc-ajax-blog-search.php` si trovi **direttamente** dentro `mu-plugins /` , e la cartella `codecorn / ajax-blog-search /` sia accanto .
61
+
Assicurati che:
63
62
64
-
2 . Verifica che WordPress stia caricando il MU plugin :
63
+
-`mu-cc-ajax-blog-search.php` sia **direttamente** dentro `mu-plugins/`
64
+
- la cartella `codecorn/ajax-blog-search/` sia accanto.
65
65
66
-
- vai in **Bacheca → Plugin → Plugin uso obbligato (Must Use)**
67
-
- dovresti vedere `MU CC Ajax Blog Search` nella lista
66
+
2. Vai in **Bacheca → Plugin → Plugin uso obbligato (Must Use)**
67
+
e verifica che **MU CC Ajax Blog Search** sia visibile.
68
68
69
-
3 . Verifica che il tema usi un **widget di ricerca** standard , ad esempio il classico widget `Cerca` nella sidebar del blog :
69
+
3. Il tema deve usare un **widget di ricerca** standard (`widget_search`).
70
+
Se nel markup trovi:
70
71
71
-
- se il markup contiene `<aside class="widget widget_search">` e un `<form class="search-form">` , il plugin può agganciarsi automaticamente
72
+
```html
73
+
<asideclass="widget widget_search">
74
+
<formclass="search-form"...></form>
75
+
</aside>
76
+
```
72
77
73
-
Non serve alcuna configurazione nel backend .
78
+
allora il plugin si aggancia automaticamente.
79
+
Nessuna configurazione aggiuntiva necessaria.
74
80
75
81
---
76
82
77
-
## Come funziona
83
+
## ⚙️ Come funziona
78
84
79
85
### Lato PHP
80
86
81
-
La classe principale `CodeCorn \ AjaxBlogSearch \ Plugin`:
87
+
La classe principale `CodeCorn\AjaxBlogSearch\Plugin`:
82
88
83
-
- registra lo script JS e , se presente , il CSS
84
-
- espone un endpoint AJAX:
89
+
- registra JS + CSS quando serve
90
+
- espone un endpoint AJAX:
85
91
86
92
-`action = cc_ajax_blog_search`
87
-
- disponibile sia per utenti loggati che non loggati
93
+
- disponibile per utenti loggati e ospiti
88
94
89
-
- esegue una query `WP_Query`sui post del blog usando il parametro`s` passato dal client
90
-
- restituisce un JSON del tipo :
95
+
- esegue una `WP_Query`con il termine`s` passato dal client
96
+
- restituisce un JSON strutturato così:
91
97
92
98
```json
93
99
{
@@ -96,130 +102,158 @@ La classe principale `CodeCorn \ AjaxBlogSearch \ Plugin` :
96
102
"results": [
97
103
{
98
104
"title": "Esempio articolo",
99
-
"url": "https : / / sito . it / esempioarticolo/",
0 commit comments