Last active
August 29, 2015 14:07
-
-
Save thomasgriffin/d5fd056b8b3dbae1ecbe to your computer and use it in GitHub Desktop.
Remove any posts from the featured content slider that do not have images in Soliloquy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'soliloquy_fc_slider_data', 'tgm_sol_remove_no_image' ); | |
function tgm_sol_remove_no_image( $data ) { | |
// Loop through the data and remove any items that don't have images. | |
foreach ( (array) $data['slider'] as $id => $item ) { | |
if ( empty( $item['src'] ) ) { | |
unset( $data['slider'][$id] ); | |
} | |
} | |
return $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment