This file contains 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
<?php | |
function mon_filtre_personnalisé($text) { | |
// Ajouter le code à exécuter | |
return $text; | |
} | |
add_filter('the_content', 'mon_filtre_personnalisé'); | |
?> |
This file contains 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
<?php | |
// Hook d'action : | |
add_action('init', 'mon_hook'); | |
function mon_hook() { | |
// votre code ici | |
} | |
// Hook de filtre : | |
add_filter('the_content', 'mon_filtre'); |
This file contains 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
<?php | |
// Déclaration de la fonction pour créer le Custom Post Type | |
function ma_fonction_cpt() { | |
// Définition des labels pour le CPT | |
$labels = array( | |
'name' => _x( 'Produits', 'Post Type General Name', 'mon_text_domain' ), | |
'singular_name' => _x( 'Produit', 'Post Type Singular Name', 'mon_text_domain' ), | |
'menu_name' => __( 'Produits', 'mon_text_domain' ), | |
'parent_item_colon' => __( 'Produit parent:', 'mon_text_domain' ), |
This file contains 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
<?php | |
// Create a new "Heures d'ouverture" taxonomy | |
function create_opening_hours_taxonomy() { | |
$labels = array( | |
'name' => _x( 'Heures d'ouverture', 'taxonomy general name', 'textdomain' ), | |
'singular_name' => _x( 'Heure d'ouverture', 'taxonomy singular name', 'textdomain' ), | |
'search_items' => __( 'Rechercher des heures d'ouverture', 'textdomain' ), | |
'all_items' => __( 'Toutes les heures d'ouverture', 'textdomain' ), | |
'parent_item' => __( 'Heure d'ouverture parente', 'textdomain' ), |
This file contains 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
<?php | |
function my_custom_shortcode($params) { | |
echo 'Hello World! You specified the following parameters: ' . $params['param1'] . ' and ' . $params['param2']; | |
} | |
add_shortcode('hello_world', 'my_custom_shortcode'); | |
?> |
This file contains 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
<?php | |
function my_custom_shortcode() { | |
echo 'Hello World!'; | |
} | |
add_shortcode('hello_world', 'my_custom_shortcode'); | |
?> |
This file contains 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
<?php | |
class Mon_Widget extends WP_Widget { | |
// Définit le constructeur | |
function __construct() { | |
$widget_ops = array( | |
'classname' => 'mon_widget', | |
'description' => 'Affiche le titre du site Web.' | |
); | |
parent::__construct( 'mon_widget', 'Mon Widget', $widget_ops ); |
This file contains 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
<?php | |
/** | |
* Add a 1% surcharge to your cart / checkout based on delivery country | |
* Taxes, shipping costs and order subtotal are all included in the surcharge amount | |
*/ | |
add_action( 'woocommerce_cart_calculate_fees',' woocommerce_custom_surcharge' ); | |
function woocommerce_custom_surcharge() { | |
global $woocommerce; | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) |
This file contains 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
<?php | |
class WeAreWP_Add_Blog_Order { | |
public static function init() { | |
$class = __CLASS__ ; | |
if ( empty( $GLOBALS[ $class ] ) ) | |
$GLOBALS[ $class ] = new $class; | |
} | |
public function __construct() { | |
add_filter( 'wpmu_blogs_columns', array( $this, 'get_id' ) ); | |
add_action( 'manage_sites_custom_column', array( $this, 'add_columns' ), 10, 2 ); |
This file contains 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
<?php | |
function check_url($url) { | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_HEADER, 1); | |
curl_setopt($ch , CURLOPT_RETURNTRANSFER, 1); | |
$data = curl_exec($ch); | |
$headers = curl_getinfo($ch); | |
curl_close($ch); |