Skip to content

Instantly share code, notes, and snippets.

<?php
add_filter( 'wpseo_breadcrumb_links', 'unbox_yoast_seo_breadcrumb_append_link' );
function unbox_yoast_seo_breadcrumb_append_link( $links ) {
global $post;
if( is_singular('cpt_events')){
$date_maintenant = date('Y-m-d H:i:s');
$event_date_start = get_field('event_date_start', $post->ID) ;
$event_date_end = get_field('event_date_end', $post->ID) ;
if( ( $date_maintenant <= $event_date_start) && ($date_maintenant <= $event_date_end )){
//thanks to : https://css-tricks.com/prevent-page-scrolling-when-a-modal-is-open/
if ($(this).parent().hasClass('open-menu') == true) {
const scrollY = document.body.style.top;
document.body.style.position = '';
document.body.style.top = '';
window.scrollTo(0, parseInt(scrollY || '0') * -1);
} else {
document.body.style.top = '-' + window.scrollY + 'px';
if ( (( document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop ) >=
<?php
$classes = ['block-video-rgpd'];
if (!empty($block['className']))
$classes = array_merge($classes, explode(' ', $block['className']));
$anchor = '';
if (!empty($block['anchor']))
$anchor = ' id="' . sanitize_title($block['anchor']) . '"';
@annelyse
annelyse / text
Last active March 28, 2023 15:56
bdd to big command line impot incorect format parameter error
IMPORT DATABASE INTO MAMP
Step One:
Open a new terminal window
CAREFUL: This will replace all tables in the database you specify!
Step Two:
/applications/MAMP/library/bin/mysql -u [USERNAME] -p [DATABASE_NAME] < [PATH_TO_SQL_FILE]
Hit the Enter Key
Example:
<?php if (!empty($post->post_parent)) {
$pagelist = get_pages("child_of=" . $post->post_parent . "&sort_column=menu_order&sort_order=asc&exclude=" . $post->ID);
$page_array = array();
foreach ($pagelist as $item) {
$page_array[] += $item->ID;
}
if (!empty($page_array)) {
@annelyse
annelyse / header
Last active September 29, 2021 13:31
<header id="header">
<div id="mainNav" class="bg-secondary">
<div class="navbar-wrapper">
<nav class="navbarMenu">
<a class="navbarMenu__brand" href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
<button class="navbarMenu__btn hamburger hamburger--spring" type="button" id="js-navbar-toggle">
<p>Menu</p>
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
@annelyse
annelyse / function
Last active November 18, 2021 15:53
function enqueue_my_scripts(){
if (!is_admin()) {
wp_deregister_script('google-hosted-jquery');
wp_dequeue_script('google-hosted-jquery');
// load style in dist folder
foreach( glob( get_template_directory(). '/dist/*.css' ) as $file ) {
$info = pathinfo($file);
// $file contains the name and extension of the file
<?php
global $wp_query;
$currentPage = get_query_var('paged');
$total = $wp_query->max_num_pages;
// si il n'y a pas de page
if( !$currentPage) {
import lottie from "lottie-web";
import "@lottiefiles/lottie-player";
import { create } from "@lottiefiles/lottie-interactivity";
const lottiesScroll = document.querySelectorAll(".lottie-scroll-player");
if (lottiesScroll.length) {
lottiesScroll.forEach(function (anim) {
// ne surtout pas le lancer dans un domContentLoad