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 | |
if ( class_exists( 'FLBuilderModule' ) ) { | |
class Beaver_Builder_Custom_Module extends FLBuilderModule { | |
public function __construct() { | |
parent::__construct( array( | |
'name' => __( 'Custom Module', 'fl-builder' ), | |
'description' => __( 'A custom Beaver Builder module.', 'fl-builder' ), | |
'category' => __( 'My Custom Modules', 'fl-builder' ), |
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 | |
/* | |
Plugin Name: Metabox Date Select | |
Plugin URI: https://example.com | |
Description: Plugin to add metabox, field to select a date and a shortcode to use this value in my content. | |
Version: 1.0 | |
Author: Your Name | |
Author URI: https://example.com | |
License: GPL2 |
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
SELECT * | |
FROM wp_posts | |
WHERE post_title = "Mon titre d'article" | |
AND post_status = 'publish' |
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 | |
<?php if ( have_posts() ) : ?> | |
<?php while (have_posts() ) : the_post(); ?> | |
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> | |
<?php the_content(); ?> | |
<?php endwhile; ?> | |
<?php endif; ?> | |
?> |
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 add_my_widget() { | |
register_widget( 'My_Widget' ); | |
} | |
add_action( 'widgets_init', 'add_my_widget' ); | |
?> |
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_notification_message( $message ) { | |
$message .= 'Ceci est mon message personnalisé.'; | |
return $message; | |
} | |
add_action( 'wp_mail', 'my_notification_message' ); | |
?> |
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_login_message() { | |
global $current_user; | |
$role = $current_user->roles[0]; | |
if ( $role == 'administrator' ) { | |
echo 'Bienvenue administrateur!'; | |
} else { | |
echo 'Bienvenue à vous!'; | |
} | |
} |
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 add_my_script() { | |
wp_enqueue_script( 'my-script', get_stylesheet_directory_uri() . '/script.js' ); | |
} | |
add_action( 'wp_head', 'add_my_script' ); | |
?> |
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é($valeur) { | |
// Modifier la valeur de la variable | |
return $valeur; | |
} | |
add_filter('nom_variable', '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 | |
function ajout_attribut_lien($text) { | |
$text = preg_replace('/(<a.*?)(>)/','$1 target="_blank"$2',$text); | |
return $text; | |
} | |
add_filter('the_content','ajout_attribut_lien'); | |
?> |