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 | |
p.ID as 'Subscription ID', | |
p.post_status as 'Subscription Status', | |
pm1.meta_value as 'Billing First Name', | |
pm2.meta_value as 'Billing Last Name', | |
pm3.meta_value as 'Billing Email', | |
oitems.order_item_name as 'Product', | |
pm4.meta_value as 'Order Total', | |
pm5.meta_value as 'Order Tax' | |
FROM wp_posts p |
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 | |
/** | |
* | |
* Shortcode to show post title truncated | |
* | |
* [posttitle] | |
* | |
*/ | |
function ns_post_title_shortcode(){ | |
return wp_trim_words( get_the_title(), 10 ); |
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 | |
/** | |
* | |
* Shortcode to show parent category | |
* | |
* [postcat] | |
* | |
*/ | |
function ns_post_cat_shortcode(){ |
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 | |
/** | |
* | |
* Post estimated reading time shortcode | |
* | |
*/ | |
function ns_reading_time_shortcode() { | |
$content = get_post_field( 'post_content', $post->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
<?php | |
/* | |
* | |
* Add new WooCommerce account menu item for a specific members role | |
* | |
* */ | |
add_filter ( 'woocommerce_account_menu_items', 'ns_members_link', 40 ); | |
function ns_members_link( $menu_links ){ | |
$product_ids = array( 38, 41, 85, 95 ); |
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 new role for specific product when order is completed WooCommerce | |
* | |
* */ | |
add_action( 'woocommerce_order_status_completed', 'ns_change_role_on_purchase' ); | |
function ns_change_role_on_purchase( $order_id ) { | |
// get order object and items |
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 | |
/* | |
* | |
* Force registering when buying specific products on WooCommerce | |
* | |
* */ | |
add_action( 'woocommerce_after_checkout_validation' , 'ns_restict_registration_for_some_products', 10, 2 ); | |
function ns_restict_registration_for_some_products( $data, $errors ) { | |
if( isset( $data['createaccount'] ) && !$data['createaccount'] ) { |
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
/** | |
* | |
* https://codex.wordpress.org/Post_Status_Transitions | |
* | |
* Send email to admin after user create new product from frontend form. | |
* Send emails on products publication | |
* @param WP_Post $post | |
* | |
* | |
*/ |
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
#!/bin/bash | |
# ------------------------------------------------- | |
# Make site directory | |
# Download WP and install WP to site directory | |
# Set WP configuration | |
# Configure NGINX for new domain-name | |
# ------------------------------------------------- | |
# | |
# Requirments: | |
# |
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 | |
$args = array( | |
'post_type' => 'projects', | |
'posts_per_page' => 9, | |
'post_status' => 'publish', | |
'meta_query' => array( | |
'relation' => 'OR', | |
array( | |
'key' => 'featured-checkbox', |