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 | |
| /** | |
| * Remove the h4 to h6 tag from the WordPress editor. | |
| * | |
| * @param array $settings The array of editor settings | |
| * @return array The modified edit settings | |
| */ | |
| function remove_headings_from_editor( $settings ) { | |
| // Default as example | |
| // $settings['block_formats'] = 'Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre;'; |
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 | |
| /* | |
| * If you add ?clear-cart to the URL the cart will be emptied | |
| */ | |
| add_action( 'init', 'woocommerce_clear_cart_url' ); | |
| function woocommerce_clear_cart_url() { | |
| if ( isset( $_GET['clear-cart'] ) ) { | |
| global $woocommerce; | |
| $woocommerce->cart->empty_cart(); |
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 | |
| /* | |
| * Unpublish products after purchase | |
| */ | |
| add_action( 'woocommerce_thankyou', 'yanco_unpublish_product_if_sold_out', 10, 1 ); | |
| function yanco_unpublish_product_if_sold_out( $order_id ) { | |
| $order = new WC_Order( $order_id ); | |
| $all_products = $order->get_items(); |
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 | |
| if ( class_exists( 'WooCommerce' ) ) { | |
| add_action( 'woocommerce_cart_calculate_fees', 'yanco_cvr_calculate_totals' ); | |
| function yanco_cvr_calculate_totals( ) { | |
| $available_gateways = WC()->payment_gateways->get_available_payment_gateways(); | |
| $current_gateway = ''; | |
| $fee_title = __('CVR Handling Fee', 'woocommerce-cvr-payment-gateway'); // Change the title to fit your needs | |
| $cvr_handling_fee = 50; // Change the value to the amount you want to charge | |
| $fee_tax_class = 'zero rate'; // Change this to the tax class you wish to use for the fee |
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 | |
| /* | |
| * Create a column. And maybe remove some of the default ones | |
| * @param array $columns Array of all user table columns {column ID} => {column Name} | |
| */ | |
| add_filter( 'manage_users_columns', 'yanco_modify_user_table' ); | |
| function yanco_modify_user_table( $columns ) { | |
| // unset( $columns['posts'] ); // maybe you would like to remove default columns | |
| $columns['registration_date'] = 'Registreret'; // add new |
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 | |
| /* | |
| * Disable All WooCommerce Styles and Scripts Except Shop Pages | |
| * NOTE: Be VERY careful with this and test properly as it may clash with other plugins | |
| */ | |
| add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_styles_scripts', 99 ); | |
| function dequeue_woocommerce_styles_scripts() { | |
| if ( function_exists( 'is_woocommerce' ) ) { | |
| if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { |
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
| CREATE TABLE IF NOT EXISTS `country` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `iso` char(2) NOT NULL, | |
| `name` varchar(80) NOT NULL, | |
| `nicename` varchar(80) NOT NULL, | |
| `iso3` char(3) DEFAULT NULL, | |
| `numcode` smallint(6) DEFAULT NULL, | |
| `phonecode` int(5) NOT NULL, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
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 | |
| /* | |
| Plugin Name: List Comment Filters | |
| Description: List all comment filters on wp_footer | |
| Version: 1.1 | |
| Author: Thomas Scholz | |
| Author URI: http://toscho.de | |
| License: GPL v2 | |
| */ |
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 | |
| // @link http://books.google.com/books?id=fvA7zLEFWZgC&pg=PA61&lpg=PA61#v=onepage&q&f=false | |
| function nice_labels( $min, $max, $ticks = 5 ) { | |
| $range = nice_number( $max, false ); | |
| $d = nice_number( $range / ( $ticks - 1 ) ); | |
| $graphmin = floor( $min / $d ) * $d; | |
| $graphmax = ceil( $max / $d ) * $d; | |
| $nfrac = max( array( - floor( log( $d, 10 ) ), 0 ) ); |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <templateSet group="WordPress"> | |
| <template name="aa" value="add_action( '$hook$', '$callback$' ); $END$" description="add_action" toReformat="false" toShortenFQNames="true"> | |
| <variable name="hook" expression="" defaultValue="" alwaysStopAt="true" /> | |
| <variable name="callback" expression="" defaultValue="" alwaysStopAt="true" /> | |
| <context> | |
| <option name="HTML_TEXT" value="false" /> | |
| <option name="HTML" value="false" /> | |
| <option name="XSL_TEXT" value="false" /> | |
| <option name="XML" value="false" /> |