Skip to content

Instantly share code, notes, and snippets.

// ajoute la nouvelle class au plugin BD APRES la suppression grâce à la priorité 999
add_action('wpbdp_loaded', function(){new WPBDP_NavXT_Integration_glink();}, 999);
@Glinkfr
Glinkfr / wpbdp-navxt-integration.php
Created May 25, 2020 09:31
Plugin pour Intégrer NavXT Breadcrumb Plugin à Business Directory Plugin
<?php
/*
Plugin Name: wpbdp navxt integration
Plugin URI: https://www.glink.fr
Version: 1.0.0
Author: L. Perderiset and Business Directory Team
Description: Better integration of NavXT Breadcrumb Plugin with Business Directory Plugin
Author URI: https://www.glink.fr
*/
@Glinkfr
Glinkfr / function.php
Created November 23, 2022 06:29
Creation d'un shortcode wordpress pour pour utiliser le fil d'Ariane du plugin NavXT Breadcrumb
function glink_bcn() {
echo '<div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">';
echo bcn_display() . '</div>';
}
add_shortcode('glink_bcn', 'glink_bcn');
@Glinkfr
Glinkfr / function.php
Created November 23, 2022 07:56
Position par défaut des boutons PayPal sur la page du produit
add_filter('woocommerce_paypal_payments_single_product_renderer_hook', function() {
return 'woocommerce_after_add_to_cart_button';
});
@Glinkfr
Glinkfr / function.php
Created November 23, 2022 08:14
Code à ajouter au fichier function du theme enfant afin de régler le problème d'affichage des boutons PayPal avec WooCommerce et Divi
add_filter('woocommerce_paypal_payments_single_product_renderer_hook', function() {
return 'woocommerce_after_add_to_cart_form';
});
@Glinkfr
Glinkfr / function.php
Created May 3, 2023 10:47
Function.php Snippets to Modify admin area Administrator rights and appearance except for a specific Administrator username (CHANGE_USERNAME)
<?php
/**
* Modify admin rights and appearance except for a specific administrator username (CHANGE_USERNAME)
*/
$current_user = wp_get_current_user();
//Checking if the current user has the 'administrator' role and their username is not 'CHANGE_USERNAME'
if (
in_array("administrator", $current_user->roles) &&
$current_user->user_login !== "CHANGE_USERNAME"
) {
@Glinkfr
Glinkfr / function.php
Created May 3, 2023 11:09
function.php Modifie l'apparence de l'administration pour les administrateurs sauf pour un seul administrateur dont le pseudonyme est CHANGE_PSEUDONYME)
<?php
/**
* Modifie l'apparence de l'administration pour les administrateurs sauf pour un seul administrateur (CHANGE_PSEUDONYME)
*/
//On récupère les infos sur l'utilisateur
$current_user = wp_get_current_user();
//On verifie que l'utilisateur connecté est un administrateur dont le pseudonyme n'est pas 'CHANGE_PSEUDONYME'
if (
@Glinkfr
Glinkfr / function.php
Last active June 27, 2023 12:03
Création du shortcode pour afficher l'année en cours par exemple dans le footer
/**
* Création du shortcode Année en cours.
*/
// utilisez [year] dans vos widgets, pages, articles ou votre footer
function shortcode_year() {
$year = date('Y');
return $year;
}
add_shortcode('year', 'shortcode_year');
@Glinkfr
Glinkfr / function.php
Last active February 12, 2024 15:08
Création d'un Shortcode pour afficher la date de la dernière modification d'un site WordPress
// création d'un Shortcode pour afficher la date en français de la dernière modification d'un site WordPress.
// ajoutez ensuite simplement le shortcode [lastupdatedate] à votre widget ou footer
function last_update(){
global $wpdb;
$wpdb->query("SET NAMES 'utf8', lc_time_names = 'fr_FR'");
$last_updates = $wpdb->get_results("SELECT DATE_FORMAT(MAX(post_modified), '%W %d %M %Y') as date_maj FROM $wpdb->posts WHERE
(post_type='post' AND post_status='publish') OR ( post_type='page' AND post_status='publish')");
foreach ($last_updates as $last_update){
return $last_update->date_maj;
@Glinkfr
Glinkfr / function.php
Last active June 27, 2023 13:22
Supprimer un élément HTML d'un site WordPress grâce à sa classe CSS
function hook_glink_footer() {
?>
<script type="text/javascript" id="remove-by-class">
jQuery(document).ready(function($) {
jQuery(".la_class_a_supprimer").remove();
});
</script>
<?php
}
add_action('wp_footer', 'hook_glink_footer', PHP_INT_MAX );