Skip to content

Instantly share code, notes, and snippets.

@mwangepatrick
Last active December 12, 2015 14:36
Show Gist options
  • Save mwangepatrick/d6a66d3e8307569d098c to your computer and use it in GitHub Desktop.
Save mwangepatrick/d6a66d3e8307569d098c to your computer and use it in GitHub Desktop.
Filter repeater using more than one sub fields
<?php
/**
* Template Name: Events
*/
get_header(); ?>
<div id="primary" class="site-content">
<div id="content" role="main">
<h3>'Type 3' images from all events:</h3>
<?php
//alternative route A:
// get repeater field data
$repeater = get_field('loan_data_table');
// vars
$tempArray = array();
if($repeater!=NULL){
//filter this crazy thing now!
foreach( $repeater as $row ) {
if($row["amount"]=="1000" && $row["maturity"]=="2"){
?>
<li>Post title : <?php echo get_the_title( $row->post_id ); ?></li>
<?php
}
}
}else{
echo "empty repeater";
}
//
//
// End of alternative route A:
</div>
</div><!-- #primary -->
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment