Skip to content

Instantly share code, notes, and snippets.

View charleslouis's full-sized avatar

okcharlo charleslouis

View GitHub Profile
@charleslouis
charleslouis / display_custom_tax_term_list.php
Created March 20, 2013 19:57
Wordpress -------------------------------- Display a list of custom taxonomy tems>links
function display_custom_tax_term_list($taxonomy) {
$arguments = array( 'taxonomy' => $taxonomy );
$terms = get_terms($taxonomy, $arguments);
$count = count($terms); $i=0;
if ($count > 0) {
$term_list = ('<ul class="unstyled" role="nav">');
foreach ($terms as $term) {
$i++;
$term_list .= '<li><a href="'. site_url() .'/'. $taxonomy . '/' . $term->slug . '" title="' . sprintf(__('Voir tous les articles étiquettés : %s', 'my_localization_domain'), $term->name) . '"><span class="plus">' . $term->name . '</span></a></li>';
@charleslouis
charleslouis / twitter-sharing-link.html
Last active December 15, 2015 07:09
Create a Twitter url that enable users to Tweet an excerpt of your article using wordpress (and Advanced Custom Field if you wish so)
//Credits to Chris Coyier for this
//http://css-tricks.com/snippets/wordpress/automatic-social-media-links/
//http://css-tricks.com/video-screencasts/113-creating-and-using-a-custom-icon-font/
<div class="social-sharer clearfix">
<a class="social-sharing btn" rel="nofollow" href="<?php echo tweet_this($post_id); ?>" target="_blank" title="Share this article with your Twitter followers">
<i aria-hidden="true" class="social-icon twitter-icon"></i>
<span>Twitter</span>
</a>
@charleslouis
charleslouis / noErrors.js
Created March 28, 2013 09:26
Credits to Andy langton. http://andylangton.co.uk/articles/javascript/disable-javascript-errors/ This simple script will prevent javascript errors from being displayed in your visitor's browser. The functionality is very simple: create a function that always returns true, and then whenever an error occurs, call this function (returning true and …
// Credits to Andy langton
// http://andylangton.co.uk/articles/javascript/disable-javascript-errors/ This simple script will prevent javascript errors from being displayed in your visitor's browser. The functionality is very simple: create a function that always returns true, and then whenever an error occurs, call this function (returning true and suppressing the error).
function noError(){return true;}
window.onerror = noError;
@charleslouis
charleslouis / scrollToTop.js
Last active December 15, 2015 12:39
Scroll to top with a small div toggling fixed in bottom-right corner only when needed
/*
Scroll to top
*/
function scroll_to_top(ID){
if (document.getElementById(ID)){
$('#'+ ID).append('<a href="#top" id="scrollToTop">haut de page</a>');
$(window).scroll(function() {
@charleslouis
charleslouis / auto-scroll.js
Created March 28, 2013 09:30
Autop scroll - for example to be used on touch devices
/*
Auto-scroll
*/
function scrollToTop(ID){
if (document.getElementById(ID)){
window.scrollTo(0,$(ID).offset().top);
}
}
@charleslouis
charleslouis / upload_max_size_WP.php
Created April 9, 2013 15:59
//increase WP upload file size to 64MB
//add this to function.php in your theme
//works with OVH pro
//increase WP upload file size to 64MB
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
@charleslouis
charleslouis / sanitize_filename_on_upload.php
Created April 9, 2013 16:01
sanitize_filename_on_upload to avoid accent and weird characters on file names To be added to function.php in your theme
function strip_accents($string){
$string = strtr($string, array(
'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'a', 'a'=>'a', 'a'=>'a', 'a'=>'a', 'ç'=>'c', 'c'=>'c', 'c'=>'c', 'c'=>'c', 'c'=>'c', 'd'=>'d', 'd'=>'d', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'e'=>'e', 'e'=>'e', 'e'=>'e', 'e'=>'e', 'e'=>'e', 'g'=>'g', 'g'=>'g', 'g'=>'g', 'h'=>'h', 'h'=>'h', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'i'=>'i', 'i'=>'i', 'i'=>'i', 'i'=>'i', 'i'=>'i', '?'=>'i', 'j'=>'j', 'k'=>'k', '?'=>'k', 'l'=>'l', 'l'=>'l', 'l'=>'l', '?'=>'l', 'l'=>'l', 'ñ'=>'n', 'n'=>'n', 'n'=>'n', 'n'=>'n', '?'=>'n', '?'=>'n', 'ð'=>'o', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'o'=>'o', 'o'=>'o', 'o'=>'o', 'œ'=>'o', 'ø'=>'o', 'r'=>'r', 'r'=>'r', 's'=>'s', 's'=>'s', 's'=>'s', 'š'=>'s', '?'=>'s', 't'=>'t', 't'=>'t', 't'=>'t', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ü'=>'u', 'u'=>'u', 'u'=>'u', 'u'=>'u', 'u'=>'u', 'u'=>'u', 'u'=>'u', 'w'=>'w', 'ý'=>'y', 'ÿ'=>'y', 'y'=>'y', 'z'=>'z', 'z'=>'z', 'ž'=>'z'
));
return $string
//Map and location
//layout
.location-wrapper,
.contact-wrapper {
.block-title {
margin-bottom: 2em;
}
}
.location-wrapper {
/**
* Add Modernizr test for box sizing
*/
Modernizr.addTest("boxsizing", function(){
return Modernizr.testAllProps("boxSizing") && (document.documentMode === undefined || document.documentMode > 7);
});
/**
* Change the width of all elements to account for border-box
*/