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
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
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
foreach($array as $key => $item){ | |
echo $key . ":" . $item . "<br>"; | |
} |
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() { | |
$("#findstore").bind("keydown", function(e) { | |
if (e.keyCode == 13) { | |
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
<?php | |
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; | |
$the_query = new WP_Query( array ( | |
'post_type' => 'offer', | |
'post_status' => 'publish', | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'paged' => $paged | |
) ); |
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 excerpt_count_js(){ | |
if ('page' != get_post_type()) { | |
echo '<script>jQuery(document).ready(function(){ | |
jQuery("#postexcerpt .handlediv").after("<div style=\"position:absolute;top:12px;right:34px;color:#666;\"><small>Excerpt length: </small><span id=\"excerpt_counter\"></span><span style=\"font-weight:bold; padding-left:7px;\">/ 500</span><small><span style=\"font-weight:bold; padding-left:7px;\">character(s).</span></small></div>"); | |
jQuery("span#excerpt_counter").text(jQuery("#excerpt").val().length); | |
jQuery("#excerpt").keyup( function() { | |
if(jQuery(this).val().length > 500){ | |
jQuery(this).val(jQuery(this).val().substr(0, 500)); |
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
cd /Applications/XAMPP/xamppfiles/ | |
This will get you to the XAMPP file directory. Now we’re going to modify your htdocs directory: | |
sudo chown -R daemon htdocs | |
Enter your root password when prompted, then finish it out with a chmod call: | |
sudo chmod -R g+w htdocs | |
And you’re done! |
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
//esempio | |
$("#findstore").autocomplete({ | |
minLength:3, | |
source: function(request, response) { | |
var matches = $.map( availableTags, function(tag) { | |
if ( tag.toUpperCase().indexOf(request.term.toUpperCase()) === 0 ) { | |
return tag; | |
} | |
}); |
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
//se si preme enter | |
$(document).on("keyup", "input", function(event) { | |
// If enter is pressed then hide keyboard. | |
if(event.keyCode == 13) { | |
$("input").blur(); | |
} | |
}); | |
//nasconde | |
$("input").blur(); |
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
//wordpress function.php | |
function _remove_script_version( $src ){ | |
$parts = explode( '?', $src ); | |
return $parts[0]; | |
} | |
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); | |
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 ); |
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 | |
function getDistance($latitude1, $longitude1, $latitude2, $longitude2) { | |
$earth_radius = 6371; | |
$dLat = deg2rad($latitude2 - $latitude1); | |
$dLon = deg2rad($longitude2 - $longitude1); | |
$a = sin($dLat/2) * sin($dLat/2) + cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * sin($dLon/2) * sin($dLon/2); | |
$c = 2 * asin(sqrt($a)); | |
$d = $earth_radius * $c; |