Skip to content

Instantly share code, notes, and snippets.

View andrezrv's full-sized avatar

Andrés Villarreal andrezrv

View GitHub Profile
@andrezrv
andrezrv / remove-query-args.php
Last active August 29, 2015 14:01
Remove query arguments from any enqueued scripts.
<?php
/**
* Remove query arguments from any enqueued scripts.
*/
function remove_query_args( $src ) {
if ( strpos( $src, 'ver=' ) ) {
$src = remove_query_arg( 'ver', $src );
}
return $src;
}
@andrezrv
andrezrv / submodules.sh
Created July 3, 2014 15:15
Using Git submodules.
# CREATE: On the root folder of a Git repository:
$ git submodule add git@bitbucket.org:nicethemes/<repo>.git location/of/submodule
# Cloning a repo that contains submodules:
$ git clone --recursive git@bitbucket.org:nicethemes/<repo>.git location/of/repo
# Or:
$ git clone git@bitbucket.org:nicethemes/<repo>.git location/of/repo
$ git submodule init
$ git submodule update
@andrezrv
andrezrv / get-admin-path.php
Created October 30, 2014 21:18
Obtain path to wp-admin directory in WordPress.
<?php
/**
* Obtain the path to the admin directory.
*
* @return string
*/
function my_plugin_get_admin_path() {
// Replace the site base URL with the absolute path to its installation directory.
$admin_path = str_replace( get_bloginfo( 'url' ) . '/', ABSPATH, get_admin_url() );
@andrezrv
andrezrv / airplane-mode-google-fonts.php
Created February 2, 2017 15:10
For WordPress, prevent Airplane Mode plugin from blocking Google Fonts.
<?php
// Prevent Airplane Mode from blocking Google Fonts.
add_filter( 'airplane_mode_parse_style', function( $value, $parsed ) {
if ( 'fonts.googleapis.com' === $parsed ) {
$value = false;
}
return $value;
}, 10, 2 );
@andrezrv
andrezrv / fix-demo-importer-toggle.css
Created July 26, 2017 13:40
Fix toggle inner in demo importer.
body.nice-framework-page-demos .nice-toggle .nice-toggle-inner {
height: auto !important;
border: 2px solid transparent !important;
}
<?php // Ignore this line.
add_action( 'save_post', 'nice_fix_yoast_seo_loading', -999 );
add_action( 'delete_post', 'nice_fix_yoast_seo_loading', -999 );
function nice_fix_yoast_seo_loading() {
if ( ! class_exists( 'WPSEO_Link_Watcher' ) ) {
return;
}
nice_loader( 'includes/public/theming/' );