• Resolved Andrew Steelsmith

    (@captaindrew80)


    I just squealed when I realized I could potentially replace the broken Calculated Fields plugin with yours.

    Can you tell me why the template below returns false instead of what I add to the Else statement? Using Math alone without If works, but I don’t want to see “false” when the total units field doesn’t exist.

    <If acf_editor=propsum_total_units exists>
    
    <Math><Field acf_editor=propsum_total_units /> / <Field acf_editor=builinfo_number_parking_spaces /></Math>
    
      <Else />
      
      it doesn't matter it always says false if total units doesn't exist
    
    </If>
Viewing 1 replies (of 1 total)
  • Hi Andrew, glad to hear you’re finding good uses for L&L! You’re right that its flexibility means that it’s able to replace a lot of other single-purpose plugins.

    I think your issue here is that you’re getting mixed up between the syntax of different tags since not all tags accept the same attributes. For the If tag, there are specific core conditions that you can use as a subject and acf_editor="..." isn’t one of them. In your case, since you’re wanting to write some conditional logic when a particular field exists, you’ll probably want to use the field attribute as the subject, like this: <If field=propsum_total_units exists>. I think that should solve your problem, but if not, don’t hesitate to follow up here.

    By the way, I thought I’d mention that you might find the Loops & Logic forum to be a better place to get product support in the future. It’s a much more active community than this support in the WordPress plugin repository and there are people with a broader range of skillsets that can help you out with all sorts of things. Hope to see you on the forum!

Viewing 1 replies (of 1 total)
  • The topic ‘If statements are always false’ is closed to new replies.