Skip to content

Instantly share code, notes, and snippets.

@dinolatoga
dinolatoga / woocommerce-optimize-scripts.php
Created July 10, 2024 09:14 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@dinolatoga
dinolatoga / fluid-fonts-and-icons.css
Created January 31, 2020 23:07 — forked from yankiara/fluid-fonts-and-icons.css
Fluid fonts and icons in CSS
body {
--base: 20;
--scale-headings: 1.44;
--scale-mobile: 0.7;
--scale-mobile-headings: 0.4;
--scale-icons: 1.4;
--min-viewport: 480;
--max-viewport: 1600;
--max-size: var(--base);
}
@dinolatoga
dinolatoga / remote-git.md
Created October 13, 2015 01:12 — forked from Integralist/remote-git.md
Basic set-up of remote git repository on a standard server

Set-up remote git repository on a standard server

The first thing to do is to install Git on the remote server.

Once you do that the rest of the process is split into three sections:

  1. Server set-up
  2. Local set-up (push commits)
  3. Server (pull commits)
@dinolatoga
dinolatoga / gist:4ddf924aeb85d62071a4
Created October 5, 2015 05:03
Cloning into existing folder
git init
git remote add origin PATH/TO/REPO
git fetch
# git checkout -t origin/master
git reset origin/master
@dinolatoga
dinolatoga / gist:0aa34115f921ef3939c5
Created September 18, 2015 12:56 — forked from remyperona/gist:13348dbcd2bbb0d9406f
WordPress customizer custom tinymce control
class Text_Editor_Custom_Control extends WP_Customize_Control
{
public $type = 'textarea';
/**
** Render the content on the theme customizer page
*/
public function render_content() { ?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php
@dinolatoga
dinolatoga / update.php
Created September 8, 2015 07:22
WordPress migration update domain name
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@dinolatoga
dinolatoga / Create ISO image from folder
Created July 14, 2015 00:40
Create an ISO image on OSX from the command line without the use of any additional tools. Source: https://matt.berther.io/2008/12/14/creating-iso-images-from-a-folder-in-osx/
hdiutil makehybrid -o ~/Desktop/image.iso ~/path/to/folder/to/be/converted -iso -joliet
@dinolatoga
dinolatoga / relatedposts.php
Last active December 1, 2015 08:52
Display Related Posts (WordPress)
@dinolatoga
dinolatoga / gist:181db2c972028c15506a
Last active August 29, 2015 14:06
Get current php version of server
<?php
echo 'Current PHP version: ' . phpversion();
echo phpversion('tidy'); // if the extension isn't enabled
@dinolatoga
dinolatoga / sort-array.php
Created April 2, 2014 03:18
Move Arrays on top or bottom
function move_to_top(&$array, $key) {
$temp = array($key => $array[$key]);
unset($array[$key]);
$array = $temp + $array;
}
function move_to_bottom(&$array, $key) {
$value = $array[$key];
unset($array[$key]);
$array[$key] = $value;