Skip to content

Instantly share code, notes, and snippets.

@ridinghoodmedia
ridinghoodmedia / wp_kses_boilerplate.php
Last active April 25, 2016 21:58
wp_kses boilerplate
// Escape and echo search output and pagination
echo wp_kses( $content, array(
'div' => array(
'class' => array(),
'id' => array()),
'ul' => array('class' => array()),
'li' => array(
'class' => array(),
'p' => array()),
'a' => array(
<?php
function my_acf_save_post_searchwp( $post_id ) {
// re-index the post
SWP()->purge_post( absint( $post_id ) );
SWP()->trigger_index();
// For some reason the above doesn't work unless there is some sort of output below it??
// The js can be any arbitrary even an alert, which causes an error with acf's redirect function
// but still updates the searchwp index
// Without the code below, the post is purged - i.e. the old meta is not found, but the new meta
@ridinghoodmedia
ridinghoodmedia / functions.php
Last active July 5, 2020 21:03
Populate Envira Gallery with ACF gallery field
/*
* Populate Envira Gallery with ACF gallery field
*
* Filters the gallery $data and replaces with the image data for our images in the ACF gallery field.
*
* @uses ACF Pro
* @uses Envira Gallery
* @param $data
* @param $gallery_id
*/