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
<?php | |
/** | |
* Alter the date order output (in this case, the format of the displayed date). | |
* | |
* @param object $order | |
*/ | |
add_action( 'woocommerce_my_account_my_orders_column_order-date', 'alter_order_date_format', 10, 1 ); | |
function alter_order_date_format( $order ) { | |
echo '<time datetime="' . date( 'Y-m-d', strtotime( $order->order_date ) ) . '" title="' . esc_attr( strtotime( $order->order_date ) ) . '">' . date_i18n( 'm/d/Y', strtotime( $order->order_date ) ) . '</time>'; |
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
<?php | |
/** | |
* Rename WooCommerce "Brands" to "Manufacturers" | |
* | |
* @param array $args | |
* | |
* @return array | |
*/ | |
add_filter( 'register_taxonomy_product_brand', 'woocomerce_brands_filter', 10, 1 ); | |
function woocomerce_brands_filter( $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
<?php | |
/** | |
* Example code taken from: https://pento.net/2014/02/18/dont-let-your-plugin-be-activated-on-incompatible-sites/ | |
*/ | |
// In this example, only allow activation on WordPress 3.7 or higherclass | |
MyPlugin { | |
function __construct() { | |
add_action( 'admin_init', array( $this, 'check_version' ) ); | |
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
<?php | |
/** | |
* Route the notification to multiple users in a bcc field. | |
* | |
* @see https://joshuadnelson.com/user-dropdown-list-custom-notification-routing-gravity-forms/#comment-12376 | |
* @see https://www.gravityhelp.com/documentation/article/notification/ | |
*/ | |
// NOTE: This is untested code, please use with caution. Test and improve as necessary. |
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
<?php | |
/** | |
* Get the first page id with the matching template slug. | |
* | |
* @author Joshua David Nelson, josh@joshuadnelson.com | |
* | |
* @param string $template This is the template slug, like 'template-about-page.php' | |
* | |
* @return mixed $page_id Int or false on failure | |
*/ |
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
<?php | |
/** | |
* Default Titles for Term Archives | |
* | |
* @author Bill Erickson | |
* @see http://www.billerickson.net/default-category-and-tag-titles | |
* | |
* @param string $headline | |
* @param object $term | |
* @return string $headline |
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
<style> | |
.header { | |
background-image: url(http://local.dev/wp-content/uploads/2016/04/image-300x151.png) | |
} | |
@media only screen and (min-width: 300px) {.header { | |
background-image: url(http://local.dev/wp-content/uploads/2016/04/image-768x386.png) | |
}} | |
@media only screen and (min-width: 768px) {.header { | |
background-image: url(http://local.dev/wp-content/uploads/2016/04/image-1024x515.png) | |
}} |
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
/* | |
WpExternalApi class use | |
$api = WpExternalApi::get('url-slug'); | |
will create endpoint at www.example.com/url-slug/json and www.example.com/url-slug/xml | |
$api->set_logic(callback); | |
function callback($input){ |
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
<?php | |
/** | |
* Get an array of gravity forms. | |
* | |
* @since 1.0.0 | |
* | |
* @return void | |
*/ | |
function jdn_gf_options() { | |
$form_array = array(); |