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 / 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
@robi09
robi09 / template_parts_gen.php
Created February 10, 2016 14:58
Get an array with all template parts from one folder
if(!function_exists('revive_home_sections')) {
function revive_home_sections() {
$array = array();
$dir = R_PATH . "/parts/home/order/*";
foreach(glob($dir) as $file) {
if(!is_dir($file)) {
$array[substr(basename($file), 0, strpos(basename($file), "."))] = ucfirst(str_replace('_', ' ', substr(substr(basename($file), 0, strpos(basename($file), ".")), 2)));
@robi09
robi09 / array_key_check.php
Last active February 4, 2016 13:01
Check if array key exists and if it is empty
if(!function_exists('array_key_check')) {
function array_key_check($key = NULL, $array = NULL) {
if($key == NULL or $array == NULL) {
return NULL;
} else {
if(array_key_exists($key, $array)) {
if(!empty($array[$key])) {
return TRUE;
}