This file contains 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
/** | |
* Get value from GTM, and update a form input | |
*/ | |
( function () { | |
window.addEventListener( "load", function () { | |
// Check for our form | |
const form = document.querySelector( '.our-form' ); | |
if ( ! form ) return; |
This file contains 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
/** | |
* Returns the number of posts for a term in a taxonomy, for a post type | |
* Found out more at https://www.darrenlambert.com/wordpress-how-to-get-the-post-count-for-a-term-and-post-type/ | |
* @param string $post_type | |
* @param string $taxonomy | |
* @return int count | |
*/ | |
function get_post_count_for_term_and_post_type( $term_id, $taxonomy, $post_type ) { | |
// Build the args |
This file contains 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
AFG : Afghanistan | |
ALA : Åland Islands | |
ALB : Albania | |
DZA : Algeria | |
ASM : American Samoa | |
AND : Andorra | |
AGO : Angola | |
AIA : Anguilla | |
ATA : Antarctica | |
ATG : Antigua and Barbuda |
This file contains 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
in wp-config.php | |
define( 'DISALLOW_FILE_EDIT', true ); // disable file editor | |
define( 'WP_POST_REVISIONS', 10 ); // keep last 10 revisions | |
in functions.php | |
add_filter( 'auto_update_plugin', '__return_true' ); // auto update plugins |
This file contains 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
# Manual deployment to staging | |
# Manual deployment to CSB and AG | |
deploy-to-staging: | |
script: | |
- apt-get update -qq && apt-get install -y -qq lftp | |
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME,'$PASSWORD' $HOST; mirror -Rnv ./ public_html/wp-content/ --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/" | |
only: | |
- master | |
when: manual |
This file contains 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
# Auto deploy staging to staging | |
# Manual deploy master to production | |
image: php:7.1.29 | |
pipelines: | |
branches: | |
staging: | |
- step: | |
name: Deploy to Staging | |
script: |
This file contains 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 | |
#-------------------------------------------------------------------------- | |
# Daily MySQL dump on OSX to use in conjuction with Time Machine | |
# | |
# 1) Save this file in some appropriate location like /usr/sbin/dbbackup.sh | |
# 2) Make sure it is executable: sudo chmod +x /usr/sbin/dbbackup.sh | |
# 3) Create the backup directory: mkdir ~/dbdumps | |
# 4) Create the cron entry to run it daily by executing the following: | |
# sudo echo "47 5 * * * /usr/sbin/dbbackup.sh" >> /usr/lib/cron/tabs/root | |
# (This will run the script at 05:47 am each day) |
This file contains 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
Much is made of the WordPress function wp_get_attachment_image_src() which returns an array of data for an attachment image. | |
But dealing with the array is not alway welcome. | |
wp_get_attachment_image_url() is your friend here as it returns the URL of the attachment at the desired size. |
This file contains 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
#$ cat fix-dropbox.sh | |
#!/bin/bash | |
# XXX: use at your own risk - do not run without understanding this first! | |
#exit 1 | |
# safety directory | |
BACKUP='/tmp/fix-dropbox/' | |
# TODO: detect or pick manually... |
This file contains 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
deploy: | |
script: | |
- apt-get update -qq && apt-get install -y -qq lftp | |
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnv ./ public_html/ --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/" | |
only: | |
- master |
NewerOlder