View functions.php
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 | |
// Register the hero block | |
function register_hero_block() { | |
register_block_type('my-plugin/hero', array( | |
'render_callback' => 'render_hero_block', | |
'attributes' => array( | |
'title' => array( | |
'type' => 'string', | |
'default' => '', | |
), |
View functions.php
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' ), |
View functions.php
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 |
View query.sql
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 = 'publié' |
View boucle.php
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; ?> | |
?> |
View action.php
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' ); | |
?> |
View action.php
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' ); | |
?> |
View action.php
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!'; | |
} | |
} |
View action.php
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' ); | |
?> |
View filtre.php
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é'); | |
?> |
NewerOlder