Skip to content

Instantly share code, notes, and snippets.

for wpconfig in /var/www/*/wp-config.php; do \
echo; site=${wpconfig%\/wp-config.php}; site=${site#\/var\/www\/}; \
gp wp $site doctor check --all
echo
done
@robi09
robi09 / rm_mysql.md
Created July 1, 2019 12:14 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@robi09
robi09 / gist:cc573baceba7f81e0f7d92f4059a971a
Created April 8, 2019 00:47 — forked from jmslbam/gist:f5a921c399d8fe6dc762
FacetWP Selections with reset
<div id="selected-filters" class="selected-filters">
<h4><?php _e('Selected filters','rc'); ?>:</h4>
<?php echo facetwp_display('selections'); ?>
<span class="facetwp-reset" onclick="FWP.reset()"><?php _e('reset all filters','rc'); ?></span>
</div>
@robi09
robi09 / functions.php
Created March 12, 2019 18:52 — forked from nullvariable/functions.php
don't send user count to wp.org stats.
<?php
add_filter( 'core_version_check_query_args', 'hide_stats', 99 );
function hide_stats( $query ) {
$query['blogs'] = 1;
$query['users'] = 1;
return $query;
}
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
@robi09
robi09 / gluphicons.php
Created April 26, 2017 12:46
Glyphicons Array
$icons = array(
'asterisk' => 'asterisk',
'plus' => 'plus',
'euro' => 'euro',
'eur' => 'eur',
'minus' => 'minus',
'cloud' => 'cloud',
'envelope' => 'envelope',
'pencil' => 'pencil',
'glass' => 'glass',
@robi09
robi09 / functions.php
Created July 25, 2016 08:11
Force login page WordPress
function redirect_login_page() {
$login_page = home_url('/login/');
$page_viewed = basename($_SERVER['REQUEST_URI']);
if($page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
wp_redirect($login_page);
exit;
}
}
add_action('init','redirect_login_page');
@robi09
robi09 / gist:178511def1a6c3bd46ae
Created October 14, 2015 09:19
WordPress - Get text domain function
/**
* Get text domain
*/
if(!function_exists('get_textdomain')) {
function get_textdomain() {
$default_headers = array( 'td' => 'Text Domain');
$text_domain = get_file_data(get_stylesheet_uri(), $default_headers );
if(array_key_exists('td', $text_domain)) {
return $text_domain['td'];
@robi09
robi09 / woocommerce_ajax_variation_threshold.php
Last active June 9, 2016 08:29
WooCommerce Variation Ajax Threshold
add_filter( 'woocommerce_ajax_variation_threshold', 'woocommerce_ajax_variation_threshold', 10, 2 );
function woocommerce_ajax_variation_threshold( $qty, $product ) {
return 10000;
}
@robi09
robi09 / custom-logo.php
Created March 9, 2016 20:31
WordPress new logo theme support function
/**
* Display the logo in your theme using the following functions: the_site_logo() and get_the_site_logo()
* Check if logo exists using the following function: has_custom_logo()
* The the_site_logo() function output is <a href="%1$s" class="site-logo-link"><img class="site-logo" data-size="%2$s" /></a>. Make sure you use the appropriate CSS classes in your theme Front End.
* The function has this filter apply_filters( 'get_the_site_logo', $html, $size );
* Use "site_logo" id in JS to create Customizer Transport
*/
/**
* Check WordPress version