Skip to content

Instantly share code, notes, and snippets.

View AndreaBarghigiani's full-sized avatar

Andrea Barghigiani AndreaBarghigiani

View GitHub Profile
@AndreaBarghigiani
AndreaBarghigiani / config.rb
Created January 26, 2014 19:06
File di configurazione per Compass di default. Apparso per la prima volta sulle pagine di html5AndMore a questo indirizzo: http://html5andmore.info/url-helpers-sprite/
#Inserisci qua i plugin che vuoi usare
#Sintassi Preferita
preferred_syntax = :scss
#Percorso al progetto
http_path = '/'
#Cartella CSS
css_dir = 'css'
#Cartella SASS
sass_dir = 'sass'
<?php
/**
* Genesis Framework.
*
* Questo file mi sara' utile per gestire il layout
* delle pagine contenenti i singoli corsi
*
* @package Genesis\Templates
* @author Codeat
* @license GPL-2.0+
@AndreaBarghigiani
AndreaBarghigiani / functions.php
Created July 2, 2016 07:56
Articolo: "Crea un Child Theme WordPress e Scopri come ti sarà Utile"
<?php
add_action( 'wp_enqueue_scripts', 'carico_stili' );
function carico_stili(){
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'parent-style' ) );
}
@AndreaBarghigiani
AndreaBarghigiani / add-capability-to-role-user.php
Created July 3, 2016 09:31
Articolo: "Tutto quello che Devi Sapere sui Ruoli degli Utenti WordPress" (https://skillsandmore.org/wordpress-ruoli/)
<?php
//Per Ruolo
function aggiungi_capability() {
// prendo il ruolo author
$ruolo = get_role( 'author' );
//Aggiungo la mia Capability
$role->add_cap( 'aggiungi_prodotto' );
}
add_action( 'admin_init', 'aggiungi_capability');
<?php
if( !function_exists( 'skam_setup') ){
function skam_setup(){
}
}
add_action( 'after_setup_theme', 'skam_setup' );
function skam_widgets_init() {
<?php
if( !function_exists( 'skam_setup') ){
function skam_setup(){
//Aggiungo il supporto al tag <title>
add_theme_support( 'title-tag' );
//Mostro il link del feed all'interno di <head>
add_theme_support( 'automatic-feed-links' );
@AndreaBarghigiani
AndreaBarghigiani / exp-action-hook.php
Last active August 21, 2016 14:58
Articolo: "Comprendiamo i WordPress Hook" https://skillsandmore.org/wordpress-hook/
<?php
function am_inserisci_autore() {
echo '<meta name="author" content="Andrea Barghigiani">\n';
} //fine am_inserisci_autore()
/* Action Hook */
add_action( 'wp_head', 'am_inserisci_autore' );
@AndreaBarghigiani
AndreaBarghigiani / loop.php
Created October 7, 2016 20:16
Esempio di WordPress Loop. Codice utilizzato in: https://skillsandmore.org/wordpress-loop-introduzione/
<?php query_posts( 'page_per_post=5&category_name=pippo' ); ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
/* Codice da eseguire in caso di contenuto trovato */
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
@AndreaBarghigiani
AndreaBarghigiani / style.css
Last active October 29, 2016 08:42
Modifichiamo i titoli impostando uno sfondo nero e un colore del testo bianco
h2, h3, h4, h5, h6{
background-color: #000;
color: #fff;
padding: 10px;
/* Imposta un angolo arrotondato in alto a destra */
border-top-right-radius: 3px;
}
@AndreaBarghigiani
AndreaBarghigiani / page-custom.php
Created November 2, 2016 14:54
Creazione di una Page Template in WordPress
<?php
/**
* Template Name: Il template per la mia pagina personalizzata
*/
//Inserire codice PHP per personalizzare la struttura della pagina.