Wednesday, February 24th, 2016
Useful code for Advanced custom fields (ACF) flexible content – perfect for page builders
<?php
if( have_rows('pagebuilder') ):
while ( have_rows('pagebuilder') ) : the_row();
if( get_row_layout() == 'hero' ):
get_template_part( 'assets/parts/pagebuilder/hero');
elseif( get_row_layout() == 'call_to_action' ):
get_template_part( 'assets/parts/pagebuilder/call-to-action');
endif;
endwhile;
else :
// no layouts found
endif;
?>
Tags: ACF, Custom Fields, Flexible content, Page builder, WordPress
Posted in PHP, WordPress | No Comments »
Monday, October 5th, 2015
<?php
$cityname = get_field('city_name');
$args = array(
'posts_per_page' => '100',
'post_type' => 'neighborhood',
'meta_key' => 'city_n',
'meta_value' => $cityname,
'order' => 'asc'
);
$cityquery = new WP_Query($args);
$i = 1;
while ( $cityquery->have_posts() ) : $cityquery-> the_post();?>
Tags: CPT UI, Custom Fields, Custom Post Types, PHP, WordPress
Posted in PHP, WordPress | No Comments »