2018 is a long time ago 🙂 I found a WP plugin that sent a webhook when a page was saved. Then used Intergromat/Make to listen for hooks sent, then used a module to access the page and get the custom fields. Worked well.
UPDATED QUESTION
Using the repeater to store mortgage rates, some with the same term.
What the PHP dose:
At some point, the code sorts ALL rows/array by mortgage term (1,2,3,4,5,10 years).
Then if the arrays have more then 1 x term (example 10 x 5-year), it finds the term with the lowest rate and only displays that rate/term/type.
This isn’t just an issue with 5-year rates, we could have 5000 x 1-year rates and 40 x 3-year rates and the sort/filter will always show the lowest rate for each term.
This part of the code has always worked fine, that’s why it has been so hard to troubleshoot.
<?php
$arr = get_field('acf_rates_fixed');
$new_arr = array(); // not sure what this dose
foreach($arr as $val){
$val['acf_rates_rate'];// not sure what this dose
if(isset($new_arr[$val['acf_rates_term']])){
$cur_rate = $new_arr[$val['acf_rates_term']]['acf_rates_rate'];
$new_arr[$val['acf_rates_term']]['acf_rates_rate'] = ($cur_rate > /* > is low and < is high */ $val['acf_rates_rate']) ? $val['acf_rates_rate'] : $cur_rate;
} else {
$new_arr[$val['acf_rates_term']] = $val;
}
}
ksort($new_arr); // not sure what this dose
$result = array_values($new_arr); // not sure what this dose
foreach($new_arr as $result) { ?>
<!-- these 3 values show perfectly -->
acf_rates_rate = <?php echo $result['acf_rates_rate']?> <br />
acf_rates_type = <?php echo $result['acf_rates_type']?> <br />
acf_rates_term = <?php echo $result['acf_rates_term']?> <br />
<!-- these show from another row --->
acf_rates_comments = <?php echo $result['acf_rates_comments']?> <br />
acf_rates_restrictions = <?php echo $result['acf_rates_restrictions']?> <br />
acf_rates_occupancy = <?php echo $result['acf_rates_occupancy']?> <br />
acf_rates_amortization = <?php echo $result['acf_rates_amortization']?> <br />
<?php } ?>
What the issue is:
Anytime it detects a duplicate term and finds the lowest rate, any keys after “rate/term/type” are from an entirely different rate, but keys from a similar term.
Any suggestions?
Job posted on codeable under “WP ACF + Repeater + Show lowest rate by term (semi works)”
I figured out the hook, in fact, I am not sure why I bothered to post this question.
That said, I can’t seem to learn a simple put request with ACF fields (json) in PHP.
Has anyone used ACF with Webhooks before?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.