Skip to content

Instantly share code, notes, and snippets.

<?php
//Custom acf endpoint;
function add_acf_field_rest( $request_data ) {
// setup query argument
$args = array(
'post_type' => 'cpt_territory',
'posts_per_page' => -1
);
<?php
$html = $block['innerHTML'];
preg_match_all('/<figcaption>(.*?)<\/figcaption>/s', $html, $match);
$legende = $match[0];
<?php
$url = 'url';
parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );
$videoId= $my_array_of_vars['v'];
<?php
/**
* Get Vimeo video id from url
*
* Supported url formats -
*
* https://vimeo.com/11111111
* http://vimeo.com/11111111
<?php
// Displays comma separated taxonomy terms.
function entry_terms() {
$terms = get_the_terms( get_the_ID() , 'tags-name' );
if ( ! empty( $terms ) ) {
echo '<p class="entry-meta"><span class="entry-terms">';
foreach ( $terms as $term ) {
$entry_terms .= $term->name . ', ';
}
<?php
// Flux RSS
add_filter( 'request', 'gkp_add_cpts_to_rss_feed' );
function gkp_add_cpts_to_rss_feed( $args ) {
if ( isset( $args['feed'] ) && !isset( $args['post_type'] ) )
$args['post_type'] = array('post', 'actualites');
return $args;
<?php
function terms_list($taxonomy, $orderby, $order, $empty = true, $type = "radio")
{
$term_args = array(
'orderby' => $orderby,
'order' => $order,
'hide_empty' => $empty,
);
// $('.wrapper-big-map').append('<div class="tooltip-svg-click"><div class="tooltip-svg-content"><span class="tooltip-close">X</span><h2 class="tooltip-heading"></h2></div><span class="arrow"></span></div>');
var tooltip = $('.tooltip-map');
$('g[id^=region_]').on('click', function (e) {
var tt = $(this).attr('id');
@annelyse
annelyse / axeptio
Last active September 3, 2024 15:01
addEventListener("DOMContentLoaded", (event) => {
console.log(window._axcb);
(_axcb = window._axcb || []).push(function(sdk) {
sdk.on('cookies:complete', function(choices) {
document
.querySelectorAll('[data-hide-on-vendor-consent]')
.forEach(el => {
const vendor = el.getAttribute('data-hide-on-vendor-consent');
el.style.display = choices[vendor] ? 'none' : 'inherit';
});