3 Plugin Name: Site Plugin for danix.xyz
4 Description: Site specific code changes for danix.xyz
5 Plugin URI: https://danix.xyz
7 Author: Danilo 'danix' Macri
8 Author URI: https://danix.xyz
12 * Disable admin bar sitewide
14 show_admin_bar( __return_false() );
17 * Allow Shortcodes inside the html widget
19 //add_filter( 'widget_text', 'do_shortcode' );
22 * make sure the links menu in the admin is visible
24 add_filter( 'pre_option_link_manager_enabled', '__return_true' );
27 * The gravatar shortcode
29 * @param email $email email address used to retrieve the gravatar image
30 * @return string HTML the image tag which will display the gravatar image.
33 function danix_gravatar( $atts ) {
46 if ( empty( $email ) ) {
50 $output = get_avatar( $email, $size, $default, $alt );
54 add_shortcode( 'gravatar', 'danix_gravatar' );
57 * Added baguette.js to display a lightbox for images and galleries
59 function baguette_register_assets() {
60 wp_register_script( 'baguettebox', plugin_dir_url( __FILE__
) . '/baguette/baguetteBox.min.js', array(), '1.11.1', true );
61 wp_register_script( 'baguetteload', plugin_dir_url( __FILE__
) . '/baguette/baguetteLoad.js', array(), '1.11.1', true );
62 wp_register_style( 'baguettebox-css', plugin_dir_url( __FILE__
) . '/baguette/baguetteBox.min.css', array(), '1.11.1' );
64 add_action( 'wp_enqueue_scripts', 'baguette_register_assets' );
66 function baguette_enqueue_assets() {
67 if ( has_block( 'gallery' ) ||
has_block( 'image' ) ) {
68 wp_enqueue_script( 'baguettebox' );
69 wp_enqueue_script( 'baguetteload' );
70 wp_enqueue_style( 'baguettebox-css' );
73 add_action( 'wp_enqueue_scripts', 'baguette_enqueue_assets' );
76 * Do not translate smileys into emoticons.
78 add_filter( 'option_use_smilies', '__return_false' );
81 # Add matomo tracking js code to head
83 if ( ! function_exists( 'matomo_tracking' ) ) :
84 function matomo_tracking() {
87 <script type
="text/javascript">
88 var _paq
= window
._paq
= window
._paq ||
[];
89 /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
90 _paq
.push(["setDocumentTitle", document
.domain +
"/" + document
.title
]);
91 _paq
.push(["setCookieDomain", "*.danix.xyz"]);
92 _paq
.push(["setDomains", ["*.danix.xyz"]]);
93 _paq
.push(['trackPageView']);
94 _paq
.push(['enableLinkTracking']);
96 var u
="//lucky.danix.xyz/";
97 _paq
.push(['setTrackerUrl', u+
'matomo.php']);
98 _paq
.push(['setSiteId', '1']);
99 var d
=document
, g
=d
.createElement('script'), s
=d
.getElementsByTagName('script')[0];
100 g
.type
='text/javascript'; g
.async
=true; g
.src
=u+
'matomo.js'; s
.parentNode
.insertBefore(g
,s
);
103 <!-- End Matomo Code
-->
107 add_action( 'wp_head', 'matomo_tracking' );