This file contains hidden or 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
//Custom Autocomplete | |
add_action('wp_ajax_nopriv_get_listing_names', 'ajax_listings'); | |
add_action('wp_ajax_get_listing_names', 'ajax_listings'); | |
function ajax_listings() { | |
global $wpdb; //get access to the WordPress database object variable | |
//get names of all taxonomy terms | |
$name = '%'.$wpdb->esc_like(stripslashes($_GET['name'])).'%'; //escape for use in LIKE statement | |
$sql = "SELECT term.term_id as id, term.name as post_title, term.slug as guid, tax.taxonomy FROM $wpdb->term_taxonomy tax |
This file contains hidden or 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
//Custom Search on Homepage | |
function custom_search_where($where){ | |
global $wpdb; | |
if (is_search() && get_search_query()) | |
$where .= "OR ((t.name LIKE '%".get_search_query()."%' OR t.slug LIKE '%".get_search_query()."%') AND {$wpdb->posts}.post_status = 'publish')"; | |
return $where; | |
} | |
function custom_search_join($join){ | |
global $wpdb; |
This file contains hidden or 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
/** | |
* Redirect Logged Out Users To Homepage | |
* | |
* @uses template_redirect() Template Redirect action hook | |
* @uses is_user_logged_in() conditional tag | |
* @uses is_page() conditional tag | |
* @uses is_front_page() conditional tag | |
* @uses wp_redirect() WP Redirect function | |
* | |
*/ |
This file contains hidden or 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
/** | |
* Redirect Logged Out Users To Homepage | |
* | |
* @uses template_redirect() Template Redirect action hook | |
* @uses is_user_logged_in() conditional tag | |
* @uses is_page() conditional tag | |
* @uses is_front_page() conditional tag | |
* @uses wp_redirect() WP Redirect function | |
* @uses home_url() Home URL function | |
* |
This file contains hidden or 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
/** | |
* Redirect Visitors To Login Page | |
* | |
* @author Zo Rizvi | |
* | |
* @uses template_redirect() Template Redirect action hook | |
* @uses is_user_logged_in() conditional tag | |
* @uses is_page() conditional tag | |
* @uses is_front_page() conditional tag | |
* @uses wp_redirect() WP Redirect function |
This file contains hidden or 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_action('admin_init', 'foo_duplicate_posts', 99999); | |
function foo_duplicate_posts(){ | |
// Only allow admins to run the script | |
if(!current_user_can('manage_options')) | |
return; | |
// Check if keyword is set | |
if(!isset($_GET['duplicate-posts'])) |
This file contains hidden or 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
//thanks to https://gist.github.com/sultann/24baa5483b4632c3cf214a8de5648204#file-ld-auto-mark-complete-php-L17 for most of | |
//this code, i just corrected it to work with ld_lesson_tag to grab the tags as the original version returned empty | |
//array since it was looking for standard wp tags | |
function ld_is_tagged($postId) { | |
//get all learndash tags on post | |
$tags = wp_get_post_terms($postId,'ld_lesson_tag'); | |
foreach ($tags as $tag) { | |
//need to check for auto-mark-complete tag exists on this post |
This file contains hidden or 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
{% capture email_title %}Thank you for your purchase! {% endcapture %} | |
{% capture email_body %} | |
{% if requires_shipping %} | |
{% case delivery_method %} | |
{% when 'pick-up' %} | |
You’ll receive an email when your order is ready for pickup. | |
{% when 'local' %} | |
Hi {{ customer.first_name }}, we're getting your order ready for delivery. | |
{% else %} | |
Hi {{ customer.first_name }}, we're getting your order ready to be shipped. We will notify you when it has been sent. |
OlderNewer