Skip to content

Instantly share code, notes, and snippets.

@quimo
quimo / project1.php
Created January 10, 2020 10:06
PHP Namespaces
<?php
namespace IFQ\project1;
class Project {
public function __construct() {
printf("Project1\n");
}
@quimo
quimo / functions.php
Last active April 19, 2018 16:57
Rendere i commenti WordPress GDPR compliance
<?php
/**
* aggiungo il checkbox privacy in coda di campi di default del form dei commenti
* https://www.smashingmagazine.com/2012/05/adding-custom-fields-in-wordpress-comment-form/
* https://codex.wordpress.org/Function_Reference/comment_form
*/
add_action( 'comment_form_logged_in_after', 'comment_form_additional_fields' );
add_action( 'comment_form_after_fields', 'comment_form_additional_fields' );
function comment_form_additional_fields() {
$commenter = wp_get_current_commenter();
@quimo
quimo / .htaccess
Created September 12, 2017 07:52
PHP | Impostazione dinamica del max_execution_time
<IfModule mod_dtimeout.c>
<Files ~ “.php”>
SetEnvIf Request_URI “index.php” DynamicTimeout=300
SetEnvIf Request_URI “themes.php” DynamicTimeout=300
SetEnvIf Request_URI “wp-admin” DynamicTimeout=300
</Files>
</IfModule>
@quimo
quimo / functions.php
Created June 12, 2017 15:17
WP | Cambiare la categoria di un post dopo un dato lasso di tempo
<?php
function changeCategory() {
define('MOVE_TIME_LIMIT', 432000); /* 5 giorni in secondi */
$args = array(
'category_name' => 'Categoria1'
);
$query = new WP_query ($args);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
@quimo
quimo / php.ini
Last active September 6, 2017 09:07
Avada | Disattivazione della cache OpCache su SiteGround (PHP 7) per problemi con temi / plugin WordPress
opcache.enable = Off
@quimo
quimo / index.html
Last active March 7, 2017 14:04
Bootstap | Equal height columns
<div class="download">
<h2 class="download__title">Titolo della sezione 1</h2>
<div class="row download__row is-flex">
<div class="col-md-4 column">
<div class="download__item">
<img class="download__item__icon" src="https://www.cabiria.net/wp-content/uploads/2017/03/pdf-icon.png" />
<h3 class="download__item__title">Titolo del documento lungo su due righe</h3>
@quimo
quimo / functions.php
Last active February 8, 2017 09:07
WP | Inclusione codice Google Analytics
<?php
function googleAnalyticsCode() {
?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('send', 'pageview');
@quimo
quimo / compound.php
Last active July 13, 2017 12:42
Compound | Simple WordPress template chunks manager
<?php
/**
* Plugin Name: Compound
* Plugin URI:
* Description: Simple WordPress template chunks manager
* Version: 1.0
* Author: Simone Alati
* Author URI: http://www.simonealati.it
*/
@quimo
quimo / init.js
Last active October 4, 2016 16:04
WP | Aggiunta di una select per una tassonomia gerarchica gestita dal plugin Search and Filters
jQuery(function(){
if (jQuery('body.home').length) {
var taxonomy = jQuery('li.sf-field-taxonomy-product_cat');
taxonomy.addClass('product_first_cat');
//clono la select della tassonomia e gli aggiungo una classe specifica
var taxonomy_clone = taxonomy.clone();
taxonomy_clone.removeClass('product_first_cat').addClass('product_second_cat');
taxonomy_clone.insertAfter(taxonomy);
@quimo
quimo / developer.html
Last active November 6, 2016 15:10
Developer vs Visual Composer
<section class="in-primo-piano">
<div class="in-primo-piano__content">
<h2>PRODOTTI IN PRIMO PIANO</h2>
<div class="product">
<h3 class="product__title">TURBO SMART</h3>
<div class="product__description">
<ol class="product__features toggleable">
<!-- feature più importante - ecco perché uso <ol> -->
<li class="product__feature">
<h4>ECO SOSTENIBILITÀ</h4>