By: Jonas Nordström, @windyjonas
Date: 2013-04-16
esc_attr( $text );
Encodes the <, >, &, " and ' (less than, greater than, ampersand, double quote and single quote) characters. Will never double encode entities.
Example:
%Y_%m_%d___DB__ |
<?php | |
/** | |
* Case-insensitive in_array() wrapper. | |
* | |
* @param mixed $needle Value to seek. | |
* @param array $haystack Array to seek in. | |
* | |
* @return bool | |
*/ |
<?php | |
$order = new WC_Order( $order_id ); | |
foreach ( $order->get_items() as $item_key => $item ) { | |
$product = $order->get_product_from_item( $item ); | |
$sku = $product->get_sku(); | |
$ wp post list --format=ids | xargs wp post update --comment_status=closed | |
# Output: | |
# Success: Updated post 2514. | |
# Success: Updated post 2511. | |
# Success: Updated post 2504. | |
# Success: Updated post 2499. | |
# Success: Updated post 2441. | |
# etc... |
# ----------------------------------------------------------------- | |
# .gitignore for WordPress @salcode | |
# ver 20180808 | |
# | |
# From the root of your project run | |
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore | |
# to download this file | |
# | |
# By default all files are ignored. You'll need to whitelist | |
# any mu-plugins, plugins, or themes you want to include in the repo. |
<?php | |
/** | |
* Case-insensitive in_array() wrapper. | |
* | |
* @param mixed $needle Value to seek. | |
* @param array $haystack Array to seek in. | |
* @param bool $strict If the third parameter strict is set to TRUE then the in_array() function will also check the types of the needle in the haystack. | |
* | |
* @return bool |
#... | |
function gitzip() { | |
git archive -o [email protected] HEAD | |
} | |
#... gitzip ZIPPED_FILE_NAME |
<?php | |
function alter_comment_form_fields($fields){ | |
$commenter = wp_get_current_commenter(); | |
$fields['author'] = '<p class="comment-form-input comment-form-author"><label for="author">' . __( 'This is a fancy label', 'your-text-domain' ) . '</label><input id="author" required name="author" type="text" placeholder="Seu nome" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" aria-required="true" /></p>'; | |
return $fields; | |
} |
# WP Plugin: Install & Acticate | |
# Usage: wpp plugin-slug | |
alias wpp="wp plugin install $* --activate" | |
# WP Theme: Install | |
# Usage: wpt plugin-slug | |
alias wpt="wp theme install $* --activate" | |
# WP Theme: Activate | |
# Usage: wpta plugin-slug |