Skip to content

Instantly share code, notes, and snippets.

@ethicka
ethicka / wrap-link-if-url-passed.php
Created July 5, 2017 17:50
Wrap Link if URL is Passed
@ethicka
ethicka / acf-validate-facebook-url-field.php
Last active July 3, 2017 15:38
ACF Validate Facebook Field
<?php
/*
* Validate Facebook URL field
* URL field must be named "facebook_video_url" or you can change is in the filter below.
* Source: https://www.advancedcustomfields.com/resources/acf-validate_value/
*/
function acf_validate_facebook_url( $valid, $value, $field, $input ){
// If already not valid, then exit
if( !$valid ) {
return $valid;

Common Commands

Apache (Ubuntu)

apache2ctl configtest - Configtest before restarting Apache.

service apache restart - Restart Apache.

service apache restart - Restart MySQL.

@ethicka
ethicka / wp-start.sh
Last active December 27, 2023 07:10
WordPress Installation with the Roots/Sage Framework and VirtualHost Creation
#!/bin/bash -e
##
# WordPress Installation and VirtualHost Creation
#
# Description: Installs a WordPress website in the ~/Sites folder, creates a homepage,
# cleans up the WP install a bit, deletes the akismet and hello dolly plugins, creates the permalinks,
# clones the roots/sage theme framework to the theme folder, deletes all the other WP default themes,
# installs/runs npm and bower and runs gulp to create the initial assets, adds a custom gitignore file
# to /wp-content, installs the roots/soil plugin, creates a git repo in wp-content, saves the WordPress
@ethicka
ethicka / hardening-wp.md
Last active September 18, 2016 22:52
Hardening WordPress

Hardening WordPress

Change file permissions

Run the following commands:

find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} \;

find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} \;

@ethicka
ethicka / redirect-to-homepage
Last active March 21, 2018 14:02
.htaccess redirect to homepage
# Redirect to homepage
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .? http://example.com/ [R=301,L]
@ethicka
ethicka / localhost-ssl.md
Last active April 12, 2024 12:26 — forked from jonathantneal/README.md
Local virtualhost SSL websites on Mac OS Sierra

Local virtualhost SSL websites on Mac OS Sierra

These instructions will guide you through the process of setting up a wildcard SSL for your local virtualhosts for offline development. Most importantly, this configuration will give you the happy, green lock in Chrome.

These instructions have only been tested on Mac OS Sierra using the pre-installed Apache and PHP versions. These instructions also assume you have virtualhosts set up locally already.


Configuring SSL

@ethicka
ethicka / head.js.chrome-ios.js
Created November 10, 2013 18:17
Add Chrome iOS class using head.js
head.ready(function() {
if(navigator.userAgent.match('CriOS')) head.feature("chrome-ios", true);
else head.feature("chrome-ios", false);
});