Skip to content

Instantly share code, notes, and snippets.

@mi-ca
mi-ca / easing.css
Last active February 8, 2021 10:59
easing.css
root{
--linear: cubic-bezier( 0.250, 0.250, 0.750, 0.750 );
--ease: cubic-bezier( 0.250, 0.100, 0.250, 1.000 );
--easein: cubic-bezier( 0.420, 0.000, 1.000, 1.000 );
--easeout:cubic-bezier( 0.000, 0.000, 0.580, 1.000 );
--easeinout:cubic-bezier( 0.420, 0.000, 0.580, 1.000 );
--outquad:cubic-bezier( 0.250, 0.460, 0.450, 0.940 );
--outcubic:cubic-bezier( 0.215, 0.610, 0.355, 1.000 );
@mi-ca
mi-ca / functions.php
Created November 26, 2020 15:13
Woocommerce cart & checkout skinning
<?php
/* code à ajouter au functions.php
// WOOCOMMERCE special styling
// charge une css à ajouter dans le dossier du child-theme enfold perso APRES celle d'Enfold -> du coup elle prend le dessus
function wc29d_scripts(){
wp_enqueue_style( 'wc29d-css', get_stylesheet_directory_uri() . '/wc_29degres.css', array('avia-style'), null );
}
// chagement des styles et scripts
@mi-ca
mi-ca / .htaccess
Created November 13, 2020 14:22
htaccess subfolder forced to root
#place htaccess in subfolder
<IfModule mod_rewrite.c>
RewriteEngine On
#redirect /folder to root
RewriteRule ^(.*)$ /$1 [R=301,L]
</IfModule>
@mi-ca
mi-ca / solution.md
Last active October 23, 2020 09:28
custom woocommerce_thumbnail size (no crop) woocommerce_cart_item_thumbnail woocommerce_thumbnail
@mi-ca
mi-ca / meta_query acf dates repeater field.php
Last active August 22, 2020 11:32
meta_query acf dates repeater field (related futures events)
<?php
function my_posts_where( $where ) {
$where = str_replace("meta_key = 'dates_$", "meta_key LIKE 'dates_%", $where);
return $where;
}
add_filter('posts_where', 'my_posts_where');
function getRelatedEvents($id,$taxonomies){
$today = date('Ymd');
$tlist=[];
@mi-ca
mi-ca / marker-adjust-zoom-mapbox.js
Created August 19, 2020 08:29
Adjust marker size depending on zoom [mapbox]
map.on('zoom', function() {
const z=Math.ceil(map.getZoom());
let scale=1;
if(z<13){
scale=.45;
}else if(z>=13 && z<14){
scale=.6;
}else{
scale=1;
}
@mi-ca
mi-ca / alter_main_query_on_archives.php
Last active August 18, 2020 16:29
WP_Query args with repeater dates
<?php
add_action( 'pre_get_posts', 'custom_query_vars' );
function custom_query_vars( $query ) {
if ( !is_admin() && $query->is_main_query()) {
if ( is_post_type_archive('evenements')) {
$today = date('Ymd');
$sixMonthsPast = date('Ymd',strtotime('today -6 months'));
$sixMonths = date('Ymd',strtotime('today +6 months'));
<?php
function getLazyLoadImg($id,$lb=true,$size='large',$title=false){
$lbOpen=$lbClose='';
$tiny = wp_get_attachment_image_src( $id, 'thumbnail' ); // récup la miniature
$largeimg = wp_get_attachment_image_src( $id, $size); // récup la taille souhaité
$image_alt = get_post_meta($id, '_wp_attachment_image_alt', TRUE);
if(!$largeimg){ // si pas de taille demandé
@mi-ca
mi-ca / tinymce.php
Last active August 16, 2017 14:54
My favorite tinymce ;)
<?php
function my_format_TinyMCE( $in ) {
$in['block_formats'] = "Paragraph=p; Heading 3=h3; Heading 4=h4";
$in['toolbar1'] = 'pastetext,bold,blockquote,italic,bullist,numlist,link,wp_adv';
$in['toolbar2'] = 'formatselect,italic,strikethrough,charmap,wp_more,unlink,removeformat,outdent,indent,undo,redo,wp_help';
$in['toolbar3'] = '';
$in['toolbar4'] = '';
return $in;
@mi-ca
mi-ca / base.php
Created August 16, 2017 13:30
Wordpress Routes to make a Sitemap
<?php
/* paste at the top of base.php */
global $wp_query;
if(isset($wp_query->query_vars['sitemap'])){
$blogs=get_blogs_urls();