Risposte nei forum create
-
AutorePost
-
olGervaPartecipante
Ciao
Ho smanettato un pochino il risutato che ho ottenuto è questo
Come dicevo devo solo pubblicare dei banner in 4/5 siti quindi nulla di complicato.WP Plugin lato client (il dominio che include file)
<?php /* Plugin Name: Include Remote Content Description: Include external file content from a URL [remote-file href="url_file"] Version: 1.0 */ if (!is_admin()) { function _olg_remote_file_call($attrs) { if (isset($attrs['href'])) { $response = wp_remote_get( $attrs['href'], array ( 'method' => 'GET', 'timeout' => 90, 'sslverify' => false, ) ); if (is_wp_error($response) or empty($response['body'])) { // log the error for review if needed $log = wc_get_logger(); $log->log('info', json_encode([$response])); return ''; } return $response['body']; } else { // log the error for review if needed $log = wc_get_logger(); $log->log('info', 'Invalid syntax. Please use: [remote-file href="url_file"]'); return ''; } } add_shortcode('remote-file', '_olg_remote_file_call'); }
Lato “server” (dominio di appoggio) file
<div> <a href="https://site-test.com" target="_blank"> <img src="http://site-server.com/image.png" alt="img" /> <p>Testo</p> </a> </div>
Short code
[remote-file href="http://site-server.com/banner.txt"]
Non usando PHP o altro intercetto il solo file TXT che viene interpretato come HTML così non appesantisco il tutto.
Nel caso, se necessario, ci sbatto dentro un PHP-RANDOM e ci faccio anche rotazione banner.let’s go
- Questa risposta è stata modificata 3 anni, 6 mesi fa da olGerva.
olGervaPartecipanteGrazie per la risposta….
Effettivamente non trovo nulla al caso.Stiamo parlando di 10 siti massimo che si occupano di una nicchia di mercato molto risicata, quindi non ho molto traffico su di essi, ma viceversa ho la necessità di aggiornare su TUTTI dei banner o date di corsi che facciamo.
Facendo due calcoli velocemente diciamo di avere circa 5/8 banner e altrettante date/testi da aggiornare.Ho trovato il plugin “include-me” che permette di inserire del codice PHP e stavo pensando di realizzare delle minipagine/blocchi in PHP da includere.
Considerando che la loro posizione nella pagina è sempre la stessa, non necessito di rotazione, non necessito di statistiche o altro simile, sono solo banali banner di rimando ad altre pagine o testi/date che informano di eventuali cambiamenti o nuove partnership, credo che possa funzionare … cosa ne dici?Onestamente non voglio imbattermi in un casino di problematiche o altro come API e via dicendo, ma penso, credo e spero che includendo uno script che mi carichi una immagine o un testo possa bastare, almeno in questa prima fase.
Grazie
olGervaPartecipanteGrazie per l’interesse.
Vediamo se riesco ad essere più chiaro.
Attualmente il plugin gestisce una serie di prodotti con i CPTs.
Ho creato un menu dedicato “prodotti” ove posso aggiungere degli articoli con MetaBox specifici, cosଠda semplificare la creazione dello stesso.
Ogni articolo ha una sua categoria principale e se necessario una sub-categoria.
es.
CASA / arredo, bagno, cucina
AUTO / gomme, accessori, motore
SERVIZI / assistenza, telefono
GIOCHI
come vedi ho 4 categorie di cui una ha la sola categoria senza sub.
Da qui, ogni prodotto viene catalogato in modo tale che abbia sicuramente una categoria primaria e se presente la possibilità di selezionare una sotto categoria
Ora volendo creare una pagina con l’elenco delle categorie, l’utente che arriva sulla pagina deve selezionare prima la categoria, quindi il sistema propone le eventuali sottocategorie ed in fine, una volta scelta la sottocategoria, il sistema visualizza i prodotti di questa scelta.
In poche parole gradirei semplificare la vita al visitatore che agisce su un “filtro” che identifico nella categoria per arrivare ad un prodotto definito o a una serie di prodotti appartenenti a quella casistica.
Logicamente la pagina archivio visualizzerà i soli prodotti di quella categoria o subcategoria ove alla selezione del prodotto avrò la single-page dello stesso.
Attualmente io ho fatto la archive-page, ma appare tutto indistintamente.
IL PROBLEMA.
Sinceramente non riesco ad estrapolare la modalità di gestione di una casistica simile.
Non so come impostare la script.
Se necessario posso allegare il mio “piccolo” plugin cosଠda chiarificare meglio cosa ho fatto. Anche se ripeto è solo fonte di una ricerca, studio e applicazione di quello che ho imparato e trovato online.
Spero diessere stato più chiaro.
Grazie
olGervaPartecipanteOK
Il primo problema l’ho risolto.
Ho sostituito i . di concatenazione con le , e il tutto funge.
Opps, mi sono accorto ors che il codice non è completo … azz
echo '
<h2>' . get_the_title() . '</h2>
<p>' . get_the_excerpt() . '</p>
<p>' . get_the_post_thumbnail() . '</p>
< a hre f="' , the_permalink() , '">' , get_the_title() , '';
Ora mi rimane come visualizzare solo alcune delle pagine e non tutte.
GrazieolGervaPartecipanteInfatti…
So come funziona un child tema e perchè crearlo.
La mia domanda è proprio per questo.
Oltre ad utilizzare un child tema, esiste un’altra modalità per far caricare delle personalizzazioni?
Dato che non lo so sto chiedendolo. Se non esiste utilizzo i child e basta.
Grazie
olGervaPartecipanteGrazie per l’intervento.
Un perchè non esiste sostanzialmente. Diciamo che è più una mia curiosità .
Come l’usare un child teme OK è una strada.
Ma in sostanza (in questo caso) io aggiungo un semplice Dashboard-Widgets per visualizzare il contatto tecnico.
Volevo evitare di creare una dir e quindi i file necessari al child teme, anche se solo due style e functions.
Ma semplicemente appoggiarmi al file functions esistente, inserire le dieci righe e fine senza preoccuparmi di
eventuali aggiornamento, dato che il tema è perfetto per quello che server.
Grazie
olGervaPartecipanteScusa non avevo aggiunto che NON volevo usare un child teme.
Siccome le modifiche sono veramente poche (10 riche di codice) era mia intenzione lasciare il più possibile il tutto
invariato.
olGervaPartecipanteGrazie a te per il feedback e per la domanda retorica/sarcastica.
Sarà come dici, ma visto che hai trovato il tempo per “quotare” il mio messaggio potevi trovarlo anche per darmi una mano credo.
Dato che questo è il forum UFFICIALE di WordPress ITA (che io sappia) è il posto dove di norma ci sono i massimi esperti di WP e per questo si pongono domande per avere una mano o trovare soluzioni ai diversi problemi.
Non ho fatto come molti, postando per comodità la mia richiesta senza degnarmi di cercare sul web una possibile soluzione. Ho cercato credimi e non trovando nulla ho sperato in un vostro aiuto.
La soluzione che ho trovato, forse non la migliore o quella giusta mi è capitata per caso nonostante abbia cercato inutilmente prima di scrivere il mkio posto.
Cmq vedila come vuoi “sarcastica”
Ciao e buona giornata.
olGervaPartecipanteGoodWeb
Nessuna risposta o aiuto??
Cmq ho risolto e trovato la soluzione semplicemente modificando
un valore nel database
table: wp_usermeta
user_id: 1
meta_key: wp_user-settings
meta_value: cancellate mfold=f oppure impostatelo a 0
Grazie cmq
olGervaPartecipanteSi grazie, questo link l’avevo gia visto.
Il fatto è che su questo server ci sono diverse applicazioni appoggiate a un Content Management CMScontrol e non vorrei poi avere problemi con le stesse.
Preferisco trovare e utilizare una soluzione che non preveda nessuna installazione di librerie o altro simile, ma che operi solo ed unicamente nella root del sito e che si basi su eventuali file nella stessa root.
Cmq ho risolto come puoi vedere sopra, mi rimane da capire perchè non funzionino tutte e tre le soluzioni suggerite oltre al fatto che mi sembra un pelo lentina l’esecuzione….
Probabilmente la mia inesperienza …….
Grazie
-
AutorePost