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 | |
/* | |
* Replace-uploads.php | |
* This replaces all accents from your uploads | |
* you can run this with wp-cli: $ wp eval-file replace-uploads.php | |
*/ | |
/** | |
* cd to right path before changes | |
*/ |
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 | |
/***************************woocommerce*hooks*********************************/ | |
// simulacion de webservices | |
function wc_batela_get_vars(){ | |
return $las_vars = array( | |
'var1'=>'Var 1', | |
'new_price'=>'Nuevo precio', | |
); | |
} | |
// aqui se imprimen las variaciones en el detalle del producto |
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 | |
// Incluir en el functions.php del sitio a exportar | |
// exportLocales | |
if( isset($_GET['exportLocales']) ){ | |
// error_reporting(E_ALL); | |
// ini_set('display_errors', TRUE); | |
// ini_set('display_startup_errors', TRUE); | |
add_action( 'init', function(){ | |
$locales = new WP_Query( array( | |
'post_type' => 'locales', |
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
<form id="search"> | |
<input type="hidden" name="action" value="custom_search" /> | |
<input type="text" id="texto" name="texto" /> | |
<input type="submit" value="submit" /> | |
</form> | |
<div id="answer"></div> | |
<script type="text/javascript"> | |
jQuery(function($){ | |
$("#search").submit(function(e){ | |
if( $("#search").hasClass("sending") ) return false; |
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
// wait for images to load | |
$(window).bind("load", function() { | |
// code here, masonry for example | |
}); | |
// validateEmail | |
function validateEmail(email) { | |
var re = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; | |
return re.test(email); | |
} | |
// Ajax call |
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 | |
/* | |
* Get json data, from webservice, for loop on the front | |
*/ | |
function get_titdesc_object(){ | |
$options = get_option( 'tooltyp_settings' ); | |
$curl = curl_init( $options['wsurl'] ); | |
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); | |
curl_setopt($curl, CURLOPT_USERPWD, $options['wsuser'].":".$options['wspassword']); //Your credentials goes here | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
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( d ) { | |
// Create a copy of this date object | |
var target = new Date(d.valueOf()); | |
// ISO week date weeks start on monday | |
// so correct the day number | |
var dayNr = (d.getDay() + 6) % 7; | |
// Set the target to the thursday of this week so the |
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 | |
/** | |
* Changes strings referencing Featured Images for a post type | |
* | |
* In this example, the post type in the filter name is "employee" | |
* and the new reference in the labels is "headshot". | |
* | |
* @see https://developer.wordpress.org/reference/hooks/post_type_labels_post_type/ | |
* | |
* @param object $labels Current post type labels |
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 | |
// add new column(s) to custom taxonomy list | |
add_filter('manage_edit-taconomyName_columns','manage_taconomyName_columns'); | |
function manage_taconomyName_columns($columns){ | |
foreach( $columns as $k=>$v ) | |
$ke = $k; | |
array_pop( $columns ); | |
return array_merge( $columns, | |
array( 'f_image'=>__('Image') ), | |
array( $ke=>$v ) |
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
<div id="loadgooglemap"></div> | |
<script src="//maps.google.com/maps/api/js?sensor=true" type="text/javascript"></script> | |
<script type="text/javascript"> | |
jQuery(function($) { | |
//------- Google Maps ---------// | |
<?php | |
$latlng = '-17.8126693,-63.1751292'; | |
$cr_text = 'mi texto va aquí'; | |
?> |