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 all orders given a product. | |
* | |
* @param integer $product_id The product ID. | |
* | |
* @return array An array of WC_Order objects. | |
*/ | |
function rfm_get_orders_by_product( $product_id ) { |
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
SELECT | |
`items`.`order_id`, | |
MAX(CASE WHEN `itemmeta`.`meta_key` = '_product_id' THEN `itemmeta`.`meta_value` END) AS `product_id` | |
FROM | |
`wp_woocommerce_order_items` AS `items` | |
INNER JOIN | |
`wp_woocommerce_order_itemmeta` AS `itemmeta` | |
ON | |
`items`.`order_item_id` = `itemmeta`.`order_item_id` | |
WHERE |
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 | |
add_filter( 'genesis_site_layout', 'sample_genesis_site_layout' ); | |
/** | |
* Callback for 'genesis_site_layout' filter. | |
* | |
* Force full width content on the single product page. | |
* | |
* @param $layout The layout slug. | |
* @return string The layout slug. |
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
# force https | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
# end force https |
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 //* do not include php tag | |
define( 'FORCE_SSL_ADMIN', true ); |
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 //* do not include php tag | |
/** | |
* Callback for WordPress register_meta() sanitize parameter. | |
* | |
* Determine if the current meta key and value should be visible within the | |
* WordPress post editor Custom Fields meta box. | |
* | |
* @see https://codex.wordpress.org/Function_Reference/register_meta | |
* |
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 //* do not include php tag | |
/** | |
* Callback for WordPress register_meta() sanitize parameter. | |
* | |
* Sanitize the 'sample_count' meta value before saved to the database. | |
* | |
* @see https://codex.wordpress.org/Function_Reference/register_meta | |
* | |
* @uses absint() |
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 //* do not include php tag | |
add_action( 'init', 'register_my_sample_meta' ); | |
/** | |
* Callback for WordPress 'init' action. | |
* | |
* Register the post meta. | |
* | |
* @uses register_meta() | |
* @see https://codex.wordpress.org/Function_Reference/register_meta |
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 | |
/** | |
* Use the custom archive setting to modify the number of posts on a custom post type archive page. | |
*/ | |
add_action( 'pre_get_posts', 'cpt_as_pre_get_posts' ); | |
/** | |
* Callback for WordPress 'pre_get_posts' action. | |
* | |
* Modify the number of posts on an testimony archive page if set to a custom value. |
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 | |
/** | |
* Display the custom meta box content with the post type 'testimony' archive settings. | |
*/ | |
/** | |
* Callback for WordPress add_meta_box() function parameter. | |
* | |
* Display the custom meta box content with the post type 'testimony' archive settings. | |
* |