Autore: FabioS
CINERGIA
——————
SYNC:
——————
wp_postmeta
wp_post
wp_term_relationship
wp_term_taxonomy
Sdoppiato tema principale + child e assegnato il clone del child al dispositivo mobile, il quale eredita il tutto dal clone del principale. In questo modo il template del sito non viene intaccato in quanto si lavora per assegnazione (tramite plugin mobile switcher) e si va a modificare un clone del template separando di fatto totalmente le strutture.
Volendo è possibile separare ancora differenziando tablet e smartphone, ma anche da iOS e Android.
Debug WP_QUERY
$customPosts = new WP_Query($yourArgs);
echo "Last SQL-Query: {$customPosts->request}";
ssh e upload ftp
lftp ftp.dominio.it
user username
password – richiesta direttamente dalla console
Posizionarsi sulla cartella di destinazione ed eseguire l’ultimo comando:
put nome-file-da-caricare
PER COLLEGARSI A UN FTP E SCARICARNE I DATI:
wget -m –ftp-user=caramaschi_dragonsales –ftp-password=xHNh1rt4bd2f18 ftp://ftp.dragonboiles.com/*
L’ultimo parametro è il percorso della cartella che si desidera scaricare, in questo caso è la root del server
IMPOTANTE
Se compare l’errore Delaying befor reconnect…
inserire questo comando set ftp:ssl-allow no
url in javascript
http://www.test.com:8082/index.php#tab2?foo=123
window.location.host www.test.com:8082 window.location.hostname www.test.com window.location.port 8082 window.location.protocol http window.location.pathname index.php window.location.href http://www.test.com:8082/index.php#tab2 window.location.hash #tab2 window.location.search ?foo=123
jQuery
$(location).attr('host'); www.test.com:8082
$(location).attr('hostname'); www.test.com
$(location).attr('port'); 8082
$(location).attr('protocol'); http
$(location).attr('pathname'); index.php
$(location).attr('href'); http://www.test.com:8082/index.php#tab2
$(location).attr('hash'); #tab2
$(location).attr('search'); ?foo=123
jQuery :: ajax submit
jQuery(document).ready(function($) {
$("#idForm").submit(function() {
var url = "http://www.dominio.com/script.php"; // the script where you handle the form input.
$.ajax({
method: "POST",
url: url,
data: $("#idForm").serialize(), // serializza tutti gli elementi.
beforeSend: function() {
console.log('invio dei dati in corso...');
}
})
.done(function(data)
{
console.log(data); // show response from the php script.
// inviaForm();
inviaForm();
})
.fail(function(xhr) { // if error occured
console.log("Error occured.please try again");
console.log(xhr.statusText + xhr.responseText);
});
return false; // avoid to execute the actual submit of the form.
});
});
function inviaForm(){
$("#idForm").submit();
}
Tutti i parametri vengono passati in POST, basterà dunque che il controller PHP che riceve i dati utilizzi il classico $_POST[‘reference’];
WPML::Gestione siti multilingua
Il selettore è il cookie che il componente WPML rilascia denominato _icl_current_language
<?php //Language specific Footer code
if ($_COOKIE['_icl_current_language'] == "en") {
echo '
<script type="text/javascript">
var _iub = _iub || [];
_iub.csConfiguration = {
cookiePolicyId: 921612,
siteId: 135641,
lang: "en"
};
(function (w, d) {
var loader = function () { var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "//cdn.iubenda.com/cookie_solution/iubenda_cs.js"; tag.parentNode.insertBefore(s, tag); };
if (w.addEventListener) { w.addEventListener("load", loader, false); } else if (w.attachEvent) { w.attachEvent("onload", loader); } else { w.onload = loader; }
})(window, document);
</script>
';
} elseif ($_COOKIE['_icl_current_language'] == "fr") {
echo '
<script type="text/javascript">
var _iub = _iub || [];
_iub.csConfiguration = {
cookiePolicyId: 984961,
siteId: 352876,
lang: "fr"
};
(function (w, d) {
var loader = function () { var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "//cdn.iubenda.com/cookie_solution/iubenda_cs.js"; tag.parentNode.insertBefore(s, tag); };
if (w.addEventListener) { w.addEventListener("load", loader, false); } else if (w.attachEvent) { w.attachEvent("onload", loader); } else { w.onload = loader; }
})(window, document);
</script>
';
} else {
echo '
<script type="text/javascript">
var _iub = _iub || [];
_iub.csConfiguration = {
cookiePolicyId: 756162,
siteId: 352862,
lang: "it"
};
(function (w, d) {
var loader = function () { var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "//cdn.iubenda.com/cookie_solution/iubenda_cs.js"; tag.parentNode.insertBefore(s, tag); };
if (w.addEventListener) { w.addEventListener("load", loader, false); } else if (w.attachEvent) { w.attachEvent("onload", loader); } else { w.onload = loader; }
})(window, document);
</script>
';
}
?>
WPML::Traduzione stringhe
Quando la lingua di default non è quella inglese WPML
AGGIORNAMENTO VERSIONE 3.3 WPML
Visual Composer::Centrare elemento
#id_elemento{
margin: 0 auto;
display: table;
}
Come centrare in una riga un elemento mantenendo le proprietà responsive.
PrestaShop::Aggiungere campo contatti extra
Fare rifermento a questo articolo : http://nemops.com/adding-new-fields-to-prestashop-contact-form/#.VY1AaRPtlHw
{theme}/contact-form.tpl
<label for="extrafield">{l s='Extra field'}</label>
{if isset($customerThread.extrafield)}
<input type="text" id="extrafield" name="extrafield" value="{$customerThread.extrafield|escape:'htmlall':'UTF-8'}" readonly="readonly" />
{else}
<input type="text" id="extrafield" name="extrafield" value="" />
{/if}
Creare ovverride: /override/class/CustomerThread.php
class CustomerThread extends CustomerThreadCore
{
public $extrafield;
public static $definition = array(
'table' => 'customer_thread',
'primary' => 'id_customer_thread',
'fields' => array(
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_contact' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_customer' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'size' => 254),
'token' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
'status' => array('type' => self::TYPE_STRING),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'extrafield' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
),
);
}
Inserire un campo nella tabelle ps_customer_thread
