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
/** | |
* woocommerce_package_rates is a 2.1+ hook | |
*/ | |
add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 ); | |
/** | |
* Hide shipping rates when free shipping is available | |
* | |
* @param array $rates Array of rates found for the package | |
* @param array $package The package array/object being shipped |
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
jQuery( document ).ready(function($) { | |
$( ".foo" ).addClass( "superfoo" ) | |
;}); |
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
INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4', 'demo', MD5('demo'), 'Your Name', '[email protected]', 'http://www.test.com/', '2011-06-07 00:00:00', '', '0', 'Your Name'); | |
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'); | |
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_user_level', '10'); | |
unmeta_id – leave this blank (it will be auto-generated) | |
user_id – this will be the id of the user you created in the previous step. Remember we picked 4. | |
meta_key – this should be wp_capabilities |
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 | |
//Display Fields | |
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 3 ); | |
//JS to add fields for new variations | |
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' ); | |
//Save variation fields | |
add_action( 'woocommerce_process_product_meta_variable', 'save_variable_fields', 10, 1 ); | |
/** |
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
You can't use html entities in a css pseudo element, because it inserts the ampersand and everything : | |
a:before { content: ''; } | |
In order to get it to work, you have to use the unicode hex values, which are stupid hard to figure out: | |
a:before { content: '\E139'; } | |
I had to use this unicode code converter to get the proper codepoints, but it would be super awesome if you provided them to begin with along with the html entities. |
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
function privateshare() { | |
$titulo = get_the_title(); | |
$enlace = get_the_permalink(); | |
$loquequiero = '<a href="mailto:?subject=Quiero compartir contigo este artículo&body=' .$titulo. ': ' .$enlace. '"><img src="email-icon.png"></a>'; | |
return $loquequiero; | |
} | |
add_shortcode("privateshare", "privateshare"); |
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 | |
add_shortcode( 'areas', 'custom_query_shortcode' ); | |
function custom_query_shortcode( $atts ) { | |
// EXAMPLE USAGE: | |
// [areas show_posts="100" post_type="page" post_parent="246"] | |
// Defaults | |
$defaults = array( | |
"show_posts" => 100, | |
"post_type" => 'page', |
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
If your table prefix is “wp_” or “wp1_” or even “wordpress_”, then changing it will bring your WordPress site security to a higher level. | |
By default Fantastico installation sets “wp_” as a prefix for each WordPress table name. Since this is a known vulnerability, malicious users can exploit your data easily. | |
They specifically look for the wp_options table, because it will alter your WordPress site look. Through wp_options they can set the url to redirect to their sites, leaving you the impression that your site was defaced. | |
If you already have a WordPress site, take a look at either your config.php file or go to phpMyAdmin in cPanel to check your tables names. | |
// Entry in config.php showing wordpress table prefix used in the installation | |
$table_prefix = ‘wp_'; // Only numbers, letters, and underscores please! | |
Attackers can easily send malicious code using JavaScript injecting SQL targeting your wp_ based tables. To make your wordpress site really secure, change the prefix to something that is difficult to |
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
// Callback - Manejador de Eventos | |
function manejadorEventos(elEvento) { | |
// Compatibilizar el evento | |
var evento = elEvento || window.event; | |
// Imprimir detalles | |
console.log("-----------------------------") | |
console.log("Type: "+evento.type); // Tipo | |
console.log("Bubbles: "+evento.bubbles); | |
console.log("Cancelable: "+evento.cancelable); | |
console.log("CurrentTarget: ", evento.currentTarget); |
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
add_filter( 'wpcf7_validate_email*', 'custom_email_confirmation_validation_filter', 20, 2 ); | |
function custom_email_confirmation_validation_filter( $result, $tag ) { | |
$tag = new WPCF7_Shortcode( $tag ); | |
if ( 'your-email-confirm' == $tag->name ) { | |
$your_email = isset( $_POST['your-email'] ) ? trim( $_POST['your-email'] ) : ''; | |
$your_email_confirm = isset( $_POST['your-email-confirm'] ) ? trim( $_POST['your-email-confirm'] ) : ''; | |
if ( $your_email != $your_email_confirm ) { |
OlderNewer