Skip to content

Instantly share code, notes, and snippets.

View aldolat's full-sized avatar
🤓
Happy in coding

Aldo Latino aldolat

🤓
Happy in coding
View GitHub Profile
@aldolat
aldolat / keybase.md
Created May 3, 2022 17:49
Proof of Keybase identity

Keybase proof

I hereby claim:

  • I am aldolat on github.
  • I am aldolat (https://keybase.io/aldolat) on keybase.
  • I have a public key ASCRvGuTwKF-vIDlCotTDdWV3iZL5z7EXGf1sOjdeaRTTwo

To claim this, I am signing this object:

<?php
$args = array(
'post_type' => 'post',
//'category_name' => 'markup',
'meta_query' => array(
array(
'key' => 'rating',
'value' => array( 2.42, 2.47 ),
'compare' => 'BETWEEN',
//'type' => 'NUMERIC',
@aldolat
aldolat / ubn_show_current_user_role.php
Last active January 10, 2021 20:03
Show the current user roles when using the plugin Private Content.
<?php
/**
* Show the current user role.
*/
function ubn_show_current_user_role( $text ) {
$user = wp_get_current_user();
$roles = '';
foreach ( $user->roles as $role ) {
$roles .= $role . ', ';
}
@aldolat
aldolat / Akonadi-MySQL-workaround.md
Last active November 23, 2023 04:25
If MySQL is installed, Akonadi doesn't work anymore. This is a possible workaround to get Akonadi back to work.
@aldolat
aldolat / change_cookie_lifetime.php
Last active May 25, 2019 11:35
Change WordPress login cookie expiration
@aldolat
aldolat / simple-footnotes.php
Last active November 13, 2022 06:53
How to fix E_DEPRECATED with SImple Footnotes WP plugin and PHP 7
<?php
/*
* Plugin Name: Simple Footnotes
* Plugin URI: http://wordpress.org/extend/plugins/simple-footnotes/
* Plugin Description: Create simple, elegant footnotes on your site. Use the <code>[ref]</code> shortcode ([ref]My note.[/ref]) and the plugin takes care of the rest. There's also a <a href="options-reading.php">setting</a> that enables you to move the footnotes below your page links, for those who paginate posts.
* Version: 0.3
* Author: Andrew Nacin
* Author URI: http://andrewnacin.com/
*/
class nacin_footnotes {
@aldolat
aldolat / user-prompt-bashrc-with-git.bash
Last active January 2, 2023 04:56
Prompt for user with git and colors
#### START ORIGINAL VERSION
#if [ "$color_prompt" = yes ]; then
# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
#else
# PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
#fi
#unset color_prompt force_color_prompt
#### END ORIGINAL VERSION
#### START MY VERSION
@aldolat
aldolat / root-prompt-bashrc.bash
Last active January 20, 2019 11:45
Prompt per root user
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
@aldolat
aldolat / cf7-js-css.php
Created April 13, 2018 20:07
Loads Javascript and CSS of Contact Form 7 plugin only when necessary.
<?php
/**
* Removes Javascript and styles of Contact Form 7 plugin.
* Put this function in your theme's functions.php file.
*
* @see https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/
*/
function my_theme_setup() {
add_filter( 'wpcf7_load_js', '__return_false' );
add_filter( 'wpcf7_load_css', '__return_false' );
@aldolat
aldolat / .playlistradio
Last active March 31, 2018 16:55
URL of some Italian Radio Stations
## INSTRUCTIONS
## - Save the file in your home folder as .playlistradio
## - Install mplayer from repository
## - Launch the following command
## mplayer -playlist ~/.playlistradio
##
## To step backward/forward in playlist use < or >
##
## You can use even with a single station:
## mplayer http://icestreaming.rai.it/1.mp3