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 | |
$countries = array | |
( | |
'AF' => 'Afghanistan', | |
'AX' => 'Aland Islands', | |
'AL' => 'Albania', | |
'DZ' => 'Algeria', | |
'AS' => 'American Samoa', | |
'AD' => 'Andorra', |
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 | |
/** | |
* Download a large distant file to a local destination. | |
* | |
* This method is very memory efficient :-) | |
* The file can be huge, PHP doesn't load it in memory. | |
* | |
* /!\ Warning, the return value is always true, you must use === to test the response type too. | |
* | |
* @author dalexandre |
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
// Remove the product rating display on product loops | |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 ); |
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
<aside id="complementary"> | |
<?php | |
//get the titles of the most popular (by number of comments) 5 published posts | |
$query_popular = 'SELECT posts.title, posts.post_id, COUNT(*) AS numcomments | |
FROM posts, comments | |
WHERE posts.is_published = 1 | |
AND posts.post_id = comments.post_id | |
GROUP BY posts.post_id | |
ORDER BY numcomments DESC |
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 | |
$countryArray = array( | |
'AD'=>array('name'=>'ANDORRA','code'=>'376'), | |
'AE'=>array('name'=>'UNITED ARAB EMIRATES','code'=>'971'), | |
'AF'=>array('name'=>'AFGHANISTAN','code'=>'93'), | |
'AG'=>array('name'=>'ANTIGUA AND BARBUDA','code'=>'1268'), | |
'AI'=>array('name'=>'ANGUILLA','code'=>'1264'), | |
'AL'=>array('name'=>'ALBANIA','code'=>'355'), | |
'AM'=>array('name'=>'ARMENIA','code'=>'374'), | |
'AN'=>array('name'=>'NETHERLANDS ANTILLES','code'=>'599'), |
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 | |
require dirname(__FILE__).'/wp-blog-header.php'; | |
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')"); | |
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'"); | |
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)"); | |
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))"); | |
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))"); | |
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')"); |
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 | |
/* | |
Plugin Name: Woocommerce Bookings Dropdown | |
Description: Swaps the date picker for a dropdown of dates | |
Version: 1.0.0 | |
Author: Webby Scots | |
Author URI: http://webbyscots.com/ | |
*/ | |
$wswp_dates_built = false; | |
add_filter('booking_form_fields','wswp_booking_form_fields'); |
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 | |
// Font Awesome v. 4.6. | |
function jt_get_font_icons() { | |
return array( | |
'fa-glass' => 'f000', | |
'fa-music' => 'f001', | |
'fa-search' => 'f002', | |
'fa-envelope-o' => 'f003', |
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 | |
$url = wp_get_attachment_url( get_post_thumbnail_id() ); | |
$filetype = wp_check_filetype($url); | |
if ($filetype[ext] == 'gif') | |
{the_post_thumbnail('full', array('class' => 'img-responsive')); } | |
else |
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 | |
// IMPORTANT UPDATE 20190307: | |
// Since WordPress 5.0.0 we can actually use much simpler solution: | |
/** | |
* Applies wrapper div around aligned blocks. | |
* | |
* Copy this function into your WordPress theme's `functions.php` file | |
* and change the `themeprefix` accordingly. |
OlderNewer