This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function url_child_shortcode() { | |
return get_stylesheet_directory_uri(); | |
} | |
add_shortcode('url_child','url_child_shortcode'); | |
function url_base_shortcode() { | |
return get_site_url(); | |
} | |
add_shortcode('url_base','url_base_shortcode'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function woocommerce_subcats_from_brand( $product_parent_cat_NAME, $title_widget ) { | |
global $wpdb, $post; | |
//$IDbyNAME = get_term_by('slug', $parent_cat_NAME, 'product_cat'); | |
//$product_cat_ID = $IDbyNAME->term_id; | |
$IDproductByNAME = get_term_by('slug', $product_parent_cat_NAME, 'product_cat'); | |
$product_parent_cat_ID = $IDproductByNAME->term_id; | |
$args = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Incremente meta_value 'facebook_like_count' | |
function update_facebook_like_count( $post_id ) { | |
$string = file_get_contents( "http://graph.facebook.com/?id=".get_permalink( $post_id ) ); | |
$json=json_decode($string,true); | |
update_post_meta( $post_id , 'facebook_like_count', $json['shares']); | |
} | |
// Shortcode per la visualizzazione degli articoli ordinati per numero di like | |
function products_order_facebook_like($atts) { | |
global $woocommerce_loop, $woocommerce; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shortcode per visualizzare gli ultimi post | |
add_shortcode( 'list-posts', 'list_posts_shortcode' ); | |
function list_posts_shortcode( $atts ) { | |
ob_start(); | |
// define attributes and their defaults | |
extract( shortcode_atts( array ( | |
'type' => 'post', | |
'order' => 'ASC', | |
'orderby' => 'date', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wpbsearchform( $atts, $form ) { | |
$atts = shortcode_atts( | |
array( | |
'search_page' => 'cerca', | |
'search_form_page' => 'modulo-ricerca', | |
'tipo1' => 'vendita', | |
'tipo2' => 'affitto' | |
), $atts); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add the field to the checkout | |
*/ | |
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' ); | |
function my_custom_checkout_field( $checkout ) { | |
echo '<div id="my_custom_checkout_field"><h2>' . __('Codice Fiscale / Partita Iva') . '</h2>'; | |
woocommerce_form_field( 'p_iva', array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* GET FACEBOOK GALLERY | |
* | |
* Visualizza n fotografie casuali di un album di facebook | |
* | |
* @param int $album_id ID dell'album di facebook | |
* @param int $pics Numero di fotografie | |
* @param int $expire Validità della cache in secondi | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Woocommerce - Lista Categorie Impostate per OWL CAROUSEL */ | |
function woocommerce_subcats_from_parentcat_by_name($parent_cat_NAME) { | |
$IDbyNAME = get_term_by('slug', $parent_cat_NAME, 'product_cat'); | |
$product_cat_ID = $IDbyNAME->term_id; | |
$args = array( | |
'hierarchical' => 1, | |
'show_option_none' => '', | |
'hide_empty' => 0, | |
'parent' => $product_cat_ID, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NOW=$(date +"%Y-%m-%d") | |
mysqldump -u nome_utente -p InserisciLaPassword nome_del_database | gzip > dump-`date -I`.gz |