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
| /** | |
| * Add the field to the checkout | |
| **/ | |
| add_action('woocommerce_after_order_notes', 'my_custom_checkout_field'); | |
| function my_custom_checkout_field( $checkout ) { | |
| echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>'; | |
| /** |
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
| add_action('pre_get_posts','func_pre_get_posts'); | |
| function func_pre_get_posts( $query ) { | |
| if( $query->is_main_query() && !$query->is_feed() && !is_admin() && $_GET['ppp']) { | |
| $query->set( 'posts_per_page', $_GET['ppp'] ); | |
| } | |
| } |
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
| //$imurl - віддалений url файла | |
| //$picpath - path до локального файла з новим іменем | |
| function save_image($imurl, $picpath) { | |
| $ch = curl_init(); | |
| $fp = fopen($picpath, 'w'); | |
| $ch = curl_init($imurl); | |
| curl_setopt($ch, CURLOPT_TIMEOUT, 50); | |
| curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
| curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | |
| curl_setopt($ch, CURLOPT_FILE, $fp); |
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
| foreach($customRelated as $customRel) | |
| { | |
| global $post; | |
| $post = $customRel; | |
| setup_postdata( $post ); | |
| wc_get_template_part( 'content', 'product' ); | |
| } | |
| wp_reset_postdata(); |
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 | |
| /* block remove "product_cat" from product category URL */ | |
| function filter_term_link( $termlink, $term, $taxonomy ) { | |
| if ( 'product_cat' != $taxonomy ) { | |
| return $termlink; | |
| } | |
| $termlink = str_replace( '/product_category/', '/', $termlink ); |
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
| function SaveToDisk(fileURL, fileName) { | |
| // for non-IE | |
| if (!window.ActiveXObject) { | |
| var save = document.createElement('a'); | |
| save.href = fileURL; | |
| save.target = '_blank'; | |
| save.download = fileName || 'unknown'; | |
| var evt = new MouseEvent('click', { | |
| 'view': window, |
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
| $vid = $video['video_link']; | |
| $vid_ex = explode("v=",$vid); | |
| $imgurl = 'http://img.youtube.com/vi/'.$vid_ex[1].'/0.jpg'; | |
| $imgurl = (@file_get_contents($imgurl))?$imgurl:'http://img.youtube.com/vi/'.$vid_ex[1].'/maxresdefault.jpg'; |
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
| document.body.innerHTML = document.body.innerHTML.replace(/ABC/g, "XYZ") |