<?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')"); |
<?php | |
function delete_associated_media( $id ) { | |
$media = get_children( array( | |
'post_parent' => $id, | |
'post_type' => 'attachment' | |
) ); | |
if( empty( $media ) ) { | |
return; |
<?php | |
function get_youtube_video_ID($youtube_video_url) { | |
/** | |
* Pattern matches | |
* http://youtu.be/ID | |
* http://www.youtube.com/embed/ID | |
* http://www.youtube.com/watch?v=ID | |
* http://www.youtube.com/?v=ID | |
* http://www.youtube.com/v/ID | |
* http://www.youtube.com/e/ID |
#apache 2.2 or 2.4 | |
<Limit GET HEAD POST PUT DELETE OPTIONS> | |
# Deprecated apache 2.2 syntax: | |
# Order Allow,Deny | |
# Allow from all | |
# Apache > 2.4 requires: | |
Require all granted | |
</Limit> |
⇐ back to the gist-blog at jrw.fi
Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.
I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.
This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso
<?php | |
/* | |
Plugin Name: woocommerce modal variationn | |
Plugin URI: # | |
Description: show modal window with product variations after clicking -add to cart-. | |
Version: 0.1 | |
Author: Maks Buriy | |
Author URI: mailto:[email protected] | |
License: GPL2 | |
*/ |
/** | |
* Copy of Excel's PMT function. | |
* Credit: http://stackoverflow.com/questions/2094967/excel-pmt-function-in-js | |
* | |
* @param rate_per_period The interest rate for the loan. | |
* @param number_of_payments The total number of payments for the loan in months. | |
* @param present_value The present value, or the total amount that a series of future payments is worth now; | |
* Also known as the principal. | |
* @param future_value The future value, or a cash balance you want to attain after the last payment is made. | |
* If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0. |
<?php | |
/* | |
参考自: | |
http://darklaunch.com/2010/09/01/http-status-codes-in-php-http-header-response-code-function | |
http://snipplr.com/view/68099/ | |
*/ | |
function HTTPStatus($num) { | |
$http = array( |
# One liner | |
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com | |
# Explained | |
wget \ | |
--recursive \ # Download the whole site. | |
--page-requisites \ # Get all assets/elements (CSS/JS/images). | |
--adjust-extension \ # Save files with .html on the end. | |
--span-hosts \ # Include necessary assets from offsite as well. | |
--convert-links \ # Update links to still work in the static version. |