Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ |
<?php | |
/** | |
* An example function used to demonstrate how to use the `user_can_save` function | |
* that provides boilerplate security checks when saving custom post meta data. | |
* | |
* The ultimate goal is provide a simple helper function to be used in themes and | |
* plugins without the need to use a set of complex conditionals and constants. | |
* | |
* Instead, the aim is to have a simplified function that's easy to read and that uses | |
* WordPress APIs. |
<?php | |
/** | |
* This little class records how long it takes each WordPress action or filter | |
* to execute which gives a good indicator of what hooks are being slow. | |
* You can then debug those hooks to see what hooked functions are causing problems. | |
* | |
* This class does NOT time the core WordPress code that is being run between hooks. | |
* You could use similar code to this that doesn't have an end processor to do that. | |
* |
alias apache-start="sudo apachectl start" | |
alias apache-stop="sudo apachectl stop" | |
alias apache-restart="sudo apachectl restart" | |
alias apache-config="subl /etc/apache2/httpd.conf /etc/apache2/extra/httpd-vhosts.conf /etc/hosts -n" | |
apache-toggle-vhost() { | |
apache_httpd_conf_file="/etc/apache2/httpd.conf" | |
commented_out=$(sudo perl -pi -e 'END { print($prefix)} s/(#?)Include (.*?-vhosts.conf$)/if($1){$prefix=""}else{$prefix="#"}$prefix."Include ".$2/e' $apache_httpd_conf_file) | |
if [ -n "$commented_out" ]; then | |
terminal-notifier -message "Virtual Hosts are disabled. Apache restarted" -title "Virtual Hosts Off" |
<?php | |
# Register custom post types on the 'init' hook. | |
add_action( 'init', 'my_register_post_types' ); | |
/** | |
* Registers post types needed by the plugin. | |
* | |
* @since 1.0.0 | |
* @access public |
Because a basic VPS at Digital Ocean costs $5 a month. And you can host as many apps as you want. An nginx serves as a proxy for your apps.
Now you don't have to install Dokku yourself anymore. There's a pre-configured Dokku image available on Digital Ocean, that you can spin up with just a few clicks...
#!/bin/bash | |
# Created on 7/17/13 by Ryan Sechrest | |
# Deploys pushed branch from the origin repository to the web directory | |
if [[ (-n $1) && (-n $2) && (-n $3) ]]; then | |
# Set path to project directory | |
project_path="/var/www/domains/$2/$3" |
Located in alphabetical order (not prefer)
C
ab
), also designed as a more modern replacement, written in C
golang
)// Add VAT and SSN fields in billing address display | |
add_filter( 'woocommerce_order_formatted_billing_address', 'custom_add_vat_ssn_formatted_billing_address', 10, 2 ); | |
function custom_add_vat_ssn_formatted_billing_address( $fields, $order ) { | |
$fields['vat'] = $order->billing_vat; | |
$fields['ssn'] = $order->billing_ssn; | |
return $fields; | |
} | |
add_filter( 'woocommerce_my_account_my_address_formatted_address', 'custom_my_account_my_address_formatted_address', 10, 3 ); |