Skip to content

Instantly share code, notes, and snippets.

@usainicola
usainicola / standard-wordpress-loop.php
Created March 12, 2018 06:50
Standard WordPress Loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class('clr'); ?>>
<?php the_title( '<h1>', '</h1>' ); ?>
<?php the_post_thumbnail(); ?>
<?php echo get_post_meta(get_the_ID(), 'meta_name', true); ?>
<?php the_content(); ?>
</div>
<?php endwhile; else: ?>
@usainicola
usainicola / ASUS Noisy Audio with Ubuntu
Last active April 11, 2018 04:58
Restart ALSA - Fix the noise
sudo alsa force-reload
function calendarioPrezzi(element,calData,year) {
var year = year ? year : new Date().getUTCFullYear();
var arrWeekdays = new Array('domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato');
//change feb days for a leap year
var arrMonths = new Array(['gennaio', 31], ['febbraio', 28], ['marzo', 31], ['aprile', 30], ['maggio', 31], ['giugno', 30], ['luglio', 31], ['agosto', 31], ['settembre', 30], ['ottobre', 31], ['novembre', 30], ['dicembre', 31]);
//================ leap year
function isLeapYear(year) {
.cControls {
display: flex;
justify-content: space-between;
align-items: center;
margin: 20px 0;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
@usainicola
usainicola / gist:c66bde2d0e92d7fbfc75dbe9abddfd76
Created November 1, 2018 14:13
reload restart xfce panel
xfce4-panel -r
.row {
display: grid;
grid-gap: var(--s11);
grid-template-columns: repeat(auto-fit, minmax(var(--s24), 1fr));
}
@media screen and (max-width: 600px) {
.row {
grid-template-columns: none;
}
@usainicola
usainicola / gist:61a80a3dc675a25e2b9c8ffc2509527a
Created November 12, 2018 16:48
ripple, waves effect, button
.waves-effect {
position: relative;
overflow: hidden;
display: inline-block;
}
.ripple {
width: 0;
height: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.4);
@usainicola
usainicola / gist:d41d27c6d3b9e927f588a548e067819e
Created December 13, 2018 18:13
wp ajax get template part
<?php
function ajax_get_template_part() {
check_ajax_referer('ajax_get_template_part','nonce');
$part = esc_attr($_POST['template_part']);
if (!$part) {return;}
get_template_part($part);
die();
}
add_action( 'wp_ajax_nopriv_ajax_get_template_part', 'ajax_get_template_part' );
<?php
// column post image
function add_thumb_column($cols) {
$cols['thumbnail'] = 'Image';
return $cols;
}
function add_thumb_value($column_name, $post_id) {
$width = (int) 120;