Last active
August 29, 2015 14:25
-
-
Save besimhu/de2e2cd52bc5864d9c5b to your computer and use it in GitHub Desktop.
Get ACF flexible content without using ACF functions.
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 | |
// get post ID | |
$pid = get_the_ID(); | |
$flex_rows = get_post_meta( $pid, 'acf_flex_content', true ); | |
if ( !empty($flex_rows) ) { | |
foreach( $flex_rows as $count => $row ) { | |
switch( $row ) { | |
// if flex module one | |
case 'flex_one': | |
$field_one = get_post_meta( $pid, 'acf_flex_content_' . $count . '_field_one', true ); | |
$field_two = get_post_meta( $pid, 'acf_flex_content_' . $count . '_field_two', true ); | |
include 'partials/flex-one.php'; | |
break; | |
// if flex module two | |
case 'flex_two'; | |
$field_one = get_post_meta( $pid, 'acf_flex_content_' . $count . '_field_one', true ); | |
$field_two = get_post_meta( $pid, 'acf_flex_content_' . $count . '_field_two', true ); | |
include 'partials/flex-two.php'; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment