Simple PHP scripts for daily use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// convert indesign tracking value to css letter-spacing | |
@function tracking-to-letter-spacing($tracking: 0) { | |
@return $tracking / 1000 * 1em; | |
} | |
@mixin tracking-to-letter-spacing($tracking: 0) { | |
letter-spacing: tracking-to-letter-spacing($tracking); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# bash -c "$(curl -s https://gist.githubusercontent.com/haze83/0a8c65479b793285e00e92f561e66f8d/raw/d2537e8e3db767a9eb0954446e6bde571f107dc1/create-config.sh)" | |
echo "WP user: " | |
read WP_USER | |
echo "PROD (no leading /, relative to $HOME): " | |
read WP_PATH_PROD | |
echo "STAGING (no leading /, relative to $HOME): " | |
read WP_PATH_STAGING |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* Adds shipping email address as cc to WoocCmmerce customer emails | |
* | |
* @param string $header WC_Email header | |
* @param string $id WC_Email id | |
* @param \WC_Order $object | |
* @return string | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function debug_wp_rewrite_dump(&$wp) { | |
echo '<pre>'; | |
global $wp_rewrite; | |
echo '<h2>rewrite rules</h2>'; | |
echo var_export($wp_rewrite->wp_rewrite_rules(), true); | |
echo '<h2>permalink structure</h2>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* F4 Background Process | |
* | |
* Based on WP_Background_Process | |
* https://github.com/A5hleyRich/wp-background-processing/blob/master/classes/wp-background-process.php | |
*/ | |
if ( ! class_exists( 'F4_Background_Process' ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias l='ls -l' | |
alias la='ls -la' | |
alias lt='ls --tree' | |
alias ll="ls -lhAF" | |
alias wp="wp-cli" | |
alias myip="curl http://ipecho.net/plain; echo" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp db search <string_to_find> --stats | |
wp search-replace old.domain.ch new.domain.ch --recurse-objects --all-tables --skip-plugins --skip-themes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://decodeunicode.org/en/u+2028 | |
SELECT * | |
FROM wp_postmeta | |
WHERE post_id = 3646; | |
SELECT * | |
FROM wp_postmeta | |
WHERE post_id IN ( |
OlderNewer