Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am em-piguet on github.
  • I am empiguet (https://keybase.io/empiguet) on keybase.
  • I have a public key ASAPEZYVo58aN6f9tnXqg6SHBB-l2-NagjS7Pq1gwPkfqAo

To claim this, I am signing this object:

@em-piguet
em-piguet / civi-update.sh
Last active December 13, 2021 12:13
Update Civi in Worpress
#!/bin/bash
################################################
##
## Update CIVI plugin in Wordpress
##
## this script is called via
## $ ssh [email protected] 'bash -s -- sites/folder 5.41.0 SiteName' < civi-update.sh
##
################################################
@em-piguet
em-piguet / medias.php
Last active September 20, 2021 10:35
<?php
/*
* ADD OEMBED TO RTS.CH
* Copied from : https://gist.github.com/marcwieland95/61074b488aae12460a17882aeb3e0fd8
*/
wp_embed_register_handler('srg', '#https?:\/\/(?:www\.)?(srf|rsi|rts|rtr)\.ch\/.*(?:detail\/|video:)((?:.{8}-.{4}-.{4}-.{4}-.{12})|\d*)(?:.startTime=(\d*)|.*)#i', function ($matches, $attr, $url, $rawattr) {
return sprintf(
'<div class="embed-container"><iframe width="560" height="315" src="https://%1$s.ch/play/embed?urn=urn:%1$s:video:%2$s" allowfullscreen allow="encrypted-media"></iframe></div>',
esc_attr($matches[1]),
esc_attr($matches[2]),
@em-piguet
em-piguet / membership-gift.php
Created May 9, 2022 12:26
If the post is a gift to the users, we remove the restriction on post content during 7 days
<?php
function acces_article_offert()
{
// only on post
if (is_singular('post')) {
// get the gift start date
$date_de_debut = get_field('article_gift');
if ($date_de_debut) {
$date_de_fin = date('Y-m-d', strtotime($date_de_debut . ' + 7 days'));
@em-piguet
em-piguet / ytacfoembed.php
Created March 11, 2024 21:55 — forked from tallesairan/ytacfoembed.php
Youtube Video gallery acf oEmbed field
<?php
function get_youtube_video_ID($youtube_video_url) {
/**
* Pattern matches
* http://youtu.be/ID
* http://www.youtube.com/embed/ID
* http://www.youtube.com/watch?v=ID
* http://www.youtube.com/?v=ID
* http://www.youtube.com/v/ID
* http://www.youtube.com/e/ID