<?php if (have_rows('neighbourhood')) { ?> <section class="square-group"> <?php while (have_rows('neighbourhood')) { the_row(); // vars $name = get_sub_field('neighbourhood_name'); $link = get_sub_field('neighbourhood_external_link'); $image = get_sub_field('neighbourhood_image'); $area = get_sub_field_object('neighbourhood_area'); $type = get_sub_field_object('neighbourhood_type'); $area_value = get_sub_field('neighbourhood_area'); $type_value = get_sub_field('neighbourhood_type'); $area_label = $area['choices'][$area_value]; $type_label = $type['choices'][$type_value]; ?> <a class="square <?php echo $type_value; ?> <?php echo $area_value; ?> all all--areas all--types" href="<?php echo $link; ?>
function update_sub_field($selector, $value, $post_id = false) { // filter post_id $post_id = acf_get_valid_post_id($post_id); // vars $field = false; // within a have_rows loop if (is_string($selector)) { // get current row $row = acf_get_row(); // override $post_id $post_id = $row['post_id']; // get sub field $field = get_sub_field_object($selector, false, false); // create dummy field if (!$field) { $field = acf_get_valid_field(array('name' => $selector, 'key' => '', 'type' => '')); } // update name $field['name'] = "{$row['name']}_{$row['i']}_{$field['name']}"; } elseif (is_array($selector)) { // validate if (count($selector) < 3) { return false; } // vars $parent_name = acf_extract_var($selector, 0); // load parent $field = acf_maybe_get_field($parent_name, $post_id); // add to name $name = "{$field['name']}"; // sub fields foreach ($selector as $s) { if (is_numeric($s)) { $row_i = intval($s) - 1; // add to name $name .= "_{$row_i}"; } else { // update parent $field = acf_get_sub_field($s, $field); // create dummy field if (!$field) { $field = acf_get_valid_field(array('name' => $s, 'key' => '', 'type' => '')); } // add to name $name .= "_{$field['name']}"; } // if } // foreach // update name $field['name'] = $name; } // delete if ($value === null) { return acf_delete_value($post_id, $field); } // update return acf_update_value($value, $post_id, $field); }
<?php $area_value = 3; if (have_rows('selected_panels')) { echo ' <section id="feature_single" class="row"> <div class="content_wrap"> '; // loop through the rows of data while (have_rows('selected_panels')) { the_row(); $panel_position = intval(get_sub_field_object('panel_display_position')['value']); $value = get_sub_field("new_panel"); $ID = $value; $args = array('p' => $ID, 'post_type' => 'feature_panels'); $loop = new WP_Query($args); // $count = $loop->post_count; while ($loop->have_posts()) { $loop->the_post(); $have_image = 0; $have_headline = 0; $have_text = 0; if ($panel_position == $area_value) { $feature_image = get_field('feature_image'); $feature_display_size = 'large'; if (!empty($feature_image)) { $have_image = 1; } if (get_field('feature_headline') != '') { $have_headline = 1; }
function custom_form_display($post_id) { if (have_rows('forms_type', $post_id)) { echo ' <form class="f-sport ac-custom ac-checkbox ac-checkmark">'; echo '<div class="middle">'; // loop through the rows of data while (have_rows('forms_type', $post_id)) { the_row(); $required_text = ''; $required_input = ''; if (get_row_layout() == 'text_field') { $filed_title = get_sub_field('filed_title'); $filed_placeholder = get_sub_field('filed_placeholder'); $required = get_sub_field('required'); if ($required) { $required_text = '[חובה]'; $required_input = 'required'; } ?> <fieldset class="row"> <div class="col"> <label for="person"><?php echo $filed_title . ' ' . $required_text; ?> </label> <input type="text" id="person" placeholder="<?php echo $filed_placeholder; ?> " <?php echo $required_input; ?> class="js-isEmpty"> </div> </fieldset> <?php } elseif (get_row_layout() == 'email_field') { $filed_title = get_sub_field('filed_title'); $filed_placeholder = get_sub_field('filed_placeholder'); $required = get_sub_field('required'); if ($required) { $required_text = '[חובה]'; $required_input = 'required'; } ?> <fieldset class="row"> <div class="col"> <label for="email"><?php echo $filed_title . ' ' . $required_text; ?> </label> <input type="email" id="email" <?php echo $required_input; ?> class="js-isEmpty js-isEmail"> </div> </fieldset> <?php } elseif (get_row_layout() == 'date_field') { } elseif (get_row_layout() == 'text_area_field') { $filed_title = get_sub_field('filed_title'); $filed_placeholder = get_sub_field('filed_placeholder'); $required = get_sub_field('required'); if ($required) { $required_text = '[חובה]'; $required_input = 'required'; } ?> <fieldset class="row"> <label for="message"><?php echo $filed_title . ' ' . $required_text; ?> </label> <textarea rows="3" id="message"></textarea> </fieldset> <?php } elseif (get_row_layout() == 'image_selector_field') { $images = get_sub_field_object('images'); $images = $images['value']; ?> <fieldset class="b-img-picker"> <div class="col-wrap"> <?php $count = 1; foreach ($images as $image) { ?> <div class="col"> <input type="radio" id="rd<?php echo $count; ?> " name="image"> <label for="rd<?php echo $count; ?> " class="radio"></label> <div class="img-wrap"><img src="<?php echo $image['image_option']['url']; ?> " alt=""></div> </div> <?php $count++; } ?> </div> </fieldset> <?php } elseif (get_row_layout() == 'chackbox_field') { $filed_title = get_sub_field('filed_title'); $fields_option = get_sub_field_object('fields_option'); $fields_option = $fields_option['value']; $count = 1; ?> <fieldset class="b-checkbox-fields"><span class="title"><?php echo $filed_title; ?> </span> <?php foreach ($fields_option as $opt) { ?> <div class="row"> <input type="checkbox" id="ck<?php echo $count; ?> "> <label for="ck<?php echo $count; ?> " class="checkbox"><?php echo $opt['option']; ?> </label> </div> <?php $count++; } ?> </fieldset> <?php } elseif (get_row_layout() == 'dropdown_field') { $filed_title = get_sub_field('filed_title'); $fields_option = get_sub_field_object('fields_option'); $fields_option = $fields_option['value']; $filed_placeholder = get_sub_field('filed_placeholder'); $required = get_sub_field('required'); if ($required) { $required_text = '[חובה]'; $required_input = 'required'; } ?> <fieldset class="b-drop-wrap"><span class="title"><?php echo $filed_title; ?> </span> <input type="hidden" required class="js-ticket"> <div class="b-drop-list"><a href="#" class="main-link js-dropdown"><span class="value"><?php echo $filed_placeholder . ' ' . $required_text; ?> </span> <svg version="1.1" viewbox="0 0 102 102" class="svg"> <path d="M78.1,96.9L31.4,50.3L78.1,3.8L74.4,0L23.9,50.3l50.5,50.3L78.1,96.9z"></path> </svg></a> <div class="b-drop"> <?php foreach ($fields_option as $opt) { echo '<a href="#" class="link js-count">' . $opt['option'] . '</a>'; } ?> </div> </div> </fieldset> <?php } elseif (get_row_layout() == 'radio_button_field') { $filed_title = get_sub_field('filed_title'); $fields_option = get_sub_field_object('fields_option'); $fields_option = $fields_option['value']; $count = 1; ?> <fieldset class="b-description"><span class="title"><?php echo $filed_title; ?> </span> <?php foreach ($fields_option as $opt) { ?> <input id="rd<?php echo $count; ?> " type="radio" name="description"> <label for="rd<?php echo $count; ?> " class="radio"><?php echo $opt['option']; ?> </label> <?php $count++; } ?> </fieldset> <?php } elseif (get_row_layout() == 'upload_file_field') { } elseif (get_row_layout() == 'rating_field') { } } } echo '</div>'; echo '</form>'; }
$i++; ?> <?php //begin image stuff $image = get_sub_field('gallery_image'); $image_thumb = $image['sizes']['b-thumb']; $alt = $image['alt']; $title = $image['title']; ?> <a href="#gallery-<?php echo $i; ?> " class="gallery-item <?php $fields = get_sub_field_object('gallery_category'); $value = $fields['value']; $choices = $fields['choices']; if ($value) { foreach ($value as $j => $b) { echo $b . ' '; } } ?> open-popup-link"> <div class="gallery-image-wrap"><img class="gallery-image" src="<?php echo $image_thumb; ?> " alt="<?php echo $alt;
<div id="block_id<?php echo $firmasite_content_blocks["block_id"]; ?> " class="content_blocks contact_form_block"> <?php if (!empty($header) && !(isset($firmasite_content_blocks["blocks"][$firmasite_content_blocks["parent"]]["collection_type"]) && "row" != $firmasite_content_blocks["blocks"][$firmasite_content_blocks["parent"]]["collection_type"])) { ?> <h3 class="header"><?php echo $header; ?> </h3> <?php } ?> <?php $field = get_sub_field_object('contact_form_inputs'); $selected_inputs = get_sub_field('contact_form_inputs'); $user = get_sub_field('who_will_get_sent_message'); if (isset($user["ID"])) { $userid = $user["ID"]; } else { $users_query = new WP_User_Query(array('role' => 'Administrator', 'orderby' => 'id')); $results = $users_query->get_results(); foreach ($results as $user) { $userid = $user->ID; } } if (!empty($selected_inputs)) { ?> <div class="firmasite_acf_contact"> <form name="firmasite_acf_contact_form" id="contact_me<?php
function get_sub_field($selector = '', $format_value = true) { // get sub field $sub_field = get_sub_field_object($selector, $format_value); // bail early if no sub field if (!$sub_field) { return false; } // return return $sub_field['value']; }
<div class="col-xs-12 col-sm-3 name"> <?php the_sub_field('title'); ?> </div> <div class="col-xs-12 col-sm-3 location"> <?php the_sub_field('location'); ?> , <?php the_sub_field('city'); ?> </div> <div class="col-xs-12 col-sm-2 status"> <?php $field = get_sub_field_object('status'); $value = get_sub_field('status'); $label = $field['choices'][$value]; echo $label; ?> </div> <div class="col-xs-12 col-sm-2"> <?php if (get_sub_field('status') == "sold_out") { ?> <span class="btn btn-block btn-success" disabled="disabled"><?php the_sub_field('button_text'); ?> </span> <?php } else {
<?php /** * Social Icons. * * @package Chroma_Theme */ if (function_exists('get_field') && have_rows('social_icons', 'option')) { ?> <ul class="social-icons"> <?php while (have_rows('social_icons', 'option')) { the_row(); $soc_object = get_sub_field_object('social_icon_type'); $soc_value = get_sub_field('social_icon_type'); $soc_title = $soc_object['choices'][$soc_value]; $soc_fa_class = 'fa fa-' . get_sub_field('social_icon_type'); if (get_sub_field('social_icon_target')) { $soc_target = ' target="_blank"'; } if (get_sub_field('social_icon_custom_class')) { // Custom Social Icons $soc_fa_class = 'fa ' . get_sub_field('social_icon_custom_class'); $soc_title = get_sub_field('social_icon_custom_name'); } ?> <li class="<?php the_sub_field('social_icon_type');
echo get_template_directory_uri(); ?> /assets/img/develop.png"> </div> <div id="download" class="hidden-column"> <?php if (get_field('footer-content')) { while (has_sub_field('footer-content')) { ?> <div class="files"> <?php if (get_row_layout() == 'downloads') { $document = get_sub_field('pdf-document'); $document_title = get_the_title($document); $document_link = wp_get_attachment_url($document); $document_object = get_sub_field_object('pdf-document'); $document_size = filesize(get_attached_file($document)); $document_size = size_format($document_size, 2); ?> <div class="file-icon"> <a href="<?php echo $document_link; ?> "><span></span></a> </div> <div class="file-text"><?php echo $document_size; ?> </div> <?php }
// check if the flexible content field has rows of data if (have_rows('flex_content')) { ?> <?php // loop through the rows of data while (have_rows('flex_content')) { the_row(); if (get_row_layout() == 'section') { $title = get_sub_field('title'); $paragraph = get_sub_field('paragraph'); $link = get_sub_field('link'); $should_create_on_top_container = !empty($title) || !empty($paragraph) || !empty($link); ?> <section class="section <?php $section_css_class = get_sub_field_object('section_css_class'); if (!empty($section_css_class)) { echo join($section_css_class['value'], ' '); } ?> <?php echo !$should_create_on_top_container ? 'section-map' : ''; ?> "> <?php $background_type = get_sub_field('background_type'); if ($background_type == 'image') { ?> <!-- Show background image --> <?php
} ?> </div> <div class="row"> <div class="col-xs-12"> <div class="colors"> <h2>Colors avaliable</h2> <?php if (have_rows('colors_available')) { // loop through the rows of data while (have_rows('colors_available')) { the_row(); ?> <?php // display a sub field value $field = get_sub_field_object('color_name'); $value = get_sub_field('color_name'); $label = $field['choices'][$value]; echo '<h3><span class="color-block" style="background: #' . $value . '"></span>' . $label . '</h3>'; ?> <?php } } else { // no rows found } ?> </div> <div class="colors"> <h2 style="margin-top: 30px;">Product Information</h2> <ul class="pdfdownloads"> <?php
} ?> </h4> <?php } } ?> <?php if (have_rows('author_6')) { while (have_rows('author_6')) { the_row(); ?> <h4> <?php $field = get_sub_field_object('author_types'); $value = get_sub_field('author_types'); $label = $field['choices'][$value]; if (!$value == 'AT0') { echo $label; } ?> <?php $posts = get_sub_field('name'); if ($posts) { ?> <?php foreach ($posts as $post) { // variable must be called $post (IMPORTANT) ?> <?php
$post_count++; echo '<!--' . $post_count . '-->'; ?> <?php $outs = array(); if (have_rows('owyl')) { ?> <?php while (have_rows('owyl')) { the_row(); ob_start(); if (get_sub_field('associated_shops') || get_sub_field('category') != 'none') { $title = get_sub_field('title'); $brand = get_sub_field('brand'); $field = get_sub_field_object('field_name'); $price = get_sub_field('price'); $image = get_sub_field('image'); $link = get_sub_field('link'); // $isFeatured = get_sub_field('featured_product'); $isSale = get_sub_field('on_sale'); $catTest = get_sub_field('category'); $label = $field['choices'][$catTest]; //$curated = get_sub_field('curated_shops'); $curated_shops = get_sub_field('associated_shops'); if ($curated_shops) { $shops = array(); foreach ($curated_shops as $shop) { $shops[] = $shop->slug; } $shops = implode(" ", $shops);
<?php //display multiple features panels if they exist $haveTwoColumnFeature = 0; $columnClass = 'col-xs-12 col-sm-4 feature_wrap'; if (have_rows('features')) { echo ' <section id="feature_multi" class="row"> <div class="content_wrap clearfix"> '; // loop through the rows of data while (have_rows('features')) { the_row(); //print_r(get_sub_field_object('use_two_columns')); $num_of_cols = intval(get_sub_field_object('use_two_columns')['value']); if ($haveTwoColumnFeature == 0 && $num_of_cols == 1) { $haveTwoColumnFeature = 1; $columnClass = 'col-xs-12 col-sm-8 feature_wrap'; } else { $columnClass = 'col-xs-12 col-sm-4 feature_wrap'; } // display a sub field value echo ' <div class="single_feature ' . $columnClass . '"> <div class="feature-inner clearfix"> '; // display feature text if ($num_of_cols == 1) { echo '<div class="col-xs-12 col-sm-6">'; }
function psp_update_sub_field($selector, $value, $post_id = false) { // filter post_id // $post_id = acf_get_valid_post_id( $post_id ); // vars $field = false; $name = ''; // within a have_rows loop if (is_string($selector)) { // loop over global data if (!empty($GLOBALS['acf_field'])) { foreach ($GLOBALS['acf_field'] as $row) { // add to name $name .= "{$row['name']}_{$row['i']}_"; // override $post_id $post_id = $row['post_id']; } } // get sub field $field = get_sub_field_object($selector); // create dummy field if (!$field) { $field = acf_get_valid_field(array('name' => $selector, 'key' => '', 'type' => '')); } // append name $name .= $field['name']; // update name $field['name'] = $name; } elseif (is_array($selector)) { // validate if (count($selector) < 3) { return false; } // vars $parent_name = acf_extract_var($selector, 0); // load parent $field = get_field_object($parent_name, $post_id, false, false); // add to name $name .= "{$field['name']}"; // sub fields foreach ($selector as $s) { if (is_numeric($s)) { $row_i = intval($s) - 1; // add to name $name .= "_{$row_i}"; } else { // update parent $field = acf_get_sub_field($s, $field); // create dummy field if (!$field) { $field = acf_get_valid_field(array('name' => $s, 'key' => '', 'type' => '')); } // add to name $name .= "_{$field['name']}"; } // if } // foreach // update name $field['name'] = $name; } // save return acf_update_value($value, $post_id, $field); }
<section id="features-wrap" class="module"> <div class="container"> <div class="container-inner"> <h2><?php the_title(); ?> Features</h2> <?php $cats = array(); if (have_rows('model_features')) { while (have_rows('model_features')) { the_row(); $obj = get_sub_field_object('model_feature_type'); // finding array of field details $obj = $obj['choices']; // refining array $types = get_sub_field('model_feature_type'); if ($types) { foreach ($types as $type) { if (!in_array($type, $cats)) { $cats[$type] = $obj[$type]; // making an array based on the $obj variable } } } } } else { }