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
functions.php | |
<?php | |
function custom_rewrite_rules() { | |
global $wp_rewrite; | |
// Define the param estado | |
add_rewrite_tag( '%estado%', '([^&]+)' ); | |
//For this result: empresas-garimpeiras/estado/pernambuco |
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 | |
$params = array('post_type' => 'garimpeiros', 'paged' => $paged); | |
if (isset($wp_query->query_vars['estado']) && '' != $wp_query->query_vars['estado'] ) : | |
$params['tax_query'] = array( | |
array( | |
'taxonomy' => 'estado', | |
'field' => 'slug', | |
'terms' => array($wp_query->query_vars['estado']), | |
) | |
); |
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 | |
$params = array('post_type' => 'garimpeiros', 'paged' => $paged); | |
if (isset($wp_query->query_vars['estado']) && '' != $wp_query->query_vars['estado'] ) : | |
$params['meta_query'] = array( | |
array( | |
'key' => 'estado', | |
'compare' => '=', | |
'value' => $wp_query->query_vars['estado'], | |
) |
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 codeAddress(address) { | |
geocoder = new google.maps.Geocoder(); | |
geocoder.geocode({ | |
'address': address | |
}, function(results, status) { | |
if (status == google.maps.GeocoderStatus.OK) { | |
var myOptions = { | |
zoom: 14, | |
center: results[0].geometry.location, | |
disableDoubleClickZoom: true, //not zoom |
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 | |
$datetime = '01/06/1985 15:45'; | |
$timestamp = DateTime::createFromFormat('d/m/Y H:i', $datetime)->getTimestamp(); | |
echo $timestamp; | |
$datetime = date('d-m-Y H:i', $timestamp); | |
var_dump($datetime); |
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
## /private/etc/hosts | |
# | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost | |
255.255.255.255 broadcasthost | |
::1 localhost |
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
//Usage | |
try { | |
$(window).on('load', function() { | |
equalize_height($('#parent'), '.element'); | |
}); | |
$(window).resize(function(){ | |
equalize_height($('#parent'), '.element'); | |
}); | |
} catch(err) {console.log(err);} |
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($) { | |
if ($.fn.style) { | |
return; | |
} | |
// Escape regex chars with \ | |
var escape = function(text) { | |
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); | |
}; |
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
<table class="form-table"> | |
<tbody> | |
<tr> | |
<th scope="row"><label>Example:</label></th> | |
<td> | |
<select name="select-name-whenever"> | |
<option>1</option> | |
<option>lorem</option> | |
</select> | |
</td> |
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 | |
$comments_per_page = 2; | |
$page = 2; | |
//MYSQL: LIMIT offset, number | |
$params = array( | |
'post_id' => $post_id, | |
'offset' => (--$page) * $comments_per_page, | |
'number' => $comments_per_page, | |
); |
OlderNewer