Skip to content

Instantly share code, notes, and snippets.

View leogopal's full-sized avatar
🌍
Working on a better, free-er web.

Leo Gopal leogopal

🌍
Working on a better, free-er web.
View GitHub Profile
@leogopal
leogopal / dev-debuggin.php
Created June 2, 2015 09:14
wp-config for dev and live environments
<?php
switch( $_SERVER['SERVER_NAME'])
{
// Dev
case 'dev.example.com':
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('ENV', 'dev');
break;
/**********************************
*
* Move WooCommerce Price on Single Product Page
*
* @author AlphaBlossom / Tony Eppright
* @link http://www.alphablossom.com
*
* Reference hook locations using woocommerce_single_product_summary hook
*
* @hooked woocommerce_template_single_title – 5
add_action('wp_head','pluginname_ajaxurl');
function pluginname_ajaxurl() {
?>
<script type="text/javascript">
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
</script>
<?php
}
//functions.php code
#For files
sudo find . -type f -exec chmod 664 {} +
#For Directories
sudo find . -type d -exec chmod 775 {} +
#For the Config File
sudo chmod 660 wp-config.php
@leogopal
leogopal / functions.php
Created February 29, 2016 10:24
WordPress Ajax example
<?php
add_action('wp_head','pluginname_ajaxurl');
function pluginname_ajaxurl() {
?>
<script type="text/javascript">
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
</script>
<?php
@leogopal
leogopal / no-jquery.md
Last active November 11, 2016 10:54
Going without jQuery (when possible) Resources
@leogopal
leogopal / wordpress-debug-mode.php
Created April 6, 2017 08:05
WordPress Debug mode Code
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
@leogopal
leogopal / keybase.md
Created May 7, 2017 12:02
Verifying myself on Keybase.io

Keybase proof

I hereby claim:

  • I am leogopal on github.
  • I am leogopal (https://keybase.io/leogopal) on keybase.
  • I have a public key ASByfyq6t9rfWSsYlbC8ER86XnzBa_QkUXLg_jq90m9YTgo

To claim this, I am signing this object:

@leogopal
leogopal / OSX Development Setup
Last active January 23, 2018 08:38
OSX Development Setup Script
#!/usr/bin/env bash
#
# Notes:
#
# - Homebrew & Git require Xcode Command Line Tools, OS X should prompt you on first install.
#
echo "Starting Mac OS X Dev Setup..."
# Check for Homebrew, install if we don't have it
@leogopal
leogopal / wp-cli-install-rec-plugins
Created January 29, 2018 04:52 — forked from MikeNGarrett/wp-cli-install-rec-plugins
Chained WordPress CLI commands to install and activate recommended plugins.
# wordpress-seo provides ability to edit meta information and provides sitemap.
# w3-total-cache provides advanced caching no matter the server technology available.
# better-wp-security provides brute force protection and a number of WordPress enhancements.
# google-analytics-for-wordpress provides robust Google Analytics integration through the Google API.
# redirection detects 404s and 301s and allows admins to set up redirects in the WP admin.
# ewww-image-optimizer provides automatic optimization of uploaded images with local libraries instead of cloud-based services.
# backupwordpress simple backup solution that can store backups above web root.
# relevanssi provides better site search using a local index.
# cloudflare is the best. Free automatic CDN and security solution.
# jarvis is a quick search for the WordPress admin. Indespensible.