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
<?php | |
/** | |
* Adds <body> custom classes relative to browsers and device types. | |
* | |
* Note: These classes are obtained via WordPress Core Globals and via the wp_is_mobile | |
* function which both rely on the user agent. wp_is_mobile() is obviously NOT a substitute | |
* to CSS media queries, but may be used for device specific features or debugging. | |
* | |
* @see https://developer.wordpress.org/apis/global-variables/#browser-detection-booleans | |
* @see https://developer.wordpress.org/reference/functions/wp_is_mobile/ |
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
<?php | |
/** | |
* Retrieves how much available entries are available for a given form. | |
* | |
* @param int|false $form_id The ID of the form. | |
*/ | |
function jba_display_available_seats( $form_id = false ) { | |
if ( ! $form_id ) { return; } | |
$form = GFAPI::get_form( $form_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
<?php | |
/** | |
* Plugin Name: Filter language attribute to force fr-CH. | |
* Author: Jb Audras | |
* Author URI: https://jeanbaptisteaudras.com | |
* License: GPLv2 or later | |
* Version: 1.0.0 | |
*/ | |
function jba_language_attributes() { |
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
<?php | |
/* | |
* Removes admin bar on front-end for everyone except admins. | |
* @audrasjb | |
*/ | |
function jba_remove_admin_bar( $show_admin_bar ) { | |
if ( ! current_user_can( 'administrator' ) && ! is_admin() ) { | |
$show_admin_bar = false; | |
} | |
return $show_admin_bar; |
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
<?php | |
function declare_geo_shortcodes() { | |
add_shortcode( 'geoLink', 'geo_shortcode_link' ); | |
add_shortcode( 'geoMap', 'geo_shortcode_map' ); | |
} | |
add_action( 'init', 'declare_geo_shortcodes' ); | |
function geo_shortcode_link() { | |
$html = "<link rel='stylesheet' href='https://unpkg.com/[email protected]/dist/leaflet.css' | |
integrity='sha512-hoalWLoI8r4UszCkZ5kL8vayOGVae1oxXe/2A4AO6J9+580uKHDO3JdHb7NzwwzK5xr/Fs0W40kiNHxM9vyTtQ==' |
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
<?php | |
function jba_hide_posted_on() { | |
if ( in_category( array( 'ma-categorie', 'une-autre-categorie' ) ) ) : | |
?> | |
<style>.posted-on { display: none; }</style> | |
<?php | |
endif; | |
} | |
add_action( 'wp_head', 'jba_hide_posted_on' ); |
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
<?php | |
function ademe_test_feed_init() { | |
/* | |
* Génère un flux personnalisé et détermine une fonction d'affichage. | |
* | |
* Le premier paramètre indique l'url du flux généré. | |
* Le second paramètre détermine la fonction d'affichage associée. | |
*/ | |
add_feed( 'ademe_press_feed_taxo_theme', 'ademe_press_feed_taxo_theme_response' ); | |
} |
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 jba_register_shortcode() { | |
add_shortcode( 'jba_posts', 'jba_shortcode_cb' ); | |
} | |
add_action( 'init', 'jba_register_shortcode' ); | |
function jba_shortcode_cb( $args ) { | |
$args = array( | |
'post_type' => 'post', | |
'posts_per_page' => 3, | |
'tax_query' => '', |
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
// Put this hook in your functions.php file | |
function jba_analytics_depending_on_language() { | |
if ( 'en' === ICL_LANGUAGE_CODE ) { | |
?> | |
<!-- INSERT YOUR SCRIPT FOR ENGLISH --> | |
<?php | |
} elseif ( 'fr' === ICL_LANGUAGE_CODE ) { | |
?> | |
<!-- INSERT YOUR SCRIPT FOR FRENCH --> | |
<?php |