Support

Account

Home Forums General Issues Single Field: Text OR Page Link?

Solved

Single Field: Text OR Page Link?

  • Is there a single field that exists that would allow the selection of a Page Link, or if that doesn’t exist, to enter plain text?

    I am trying to revamp a band competition website – mostly focused in Michigan, but does have occasional out of state instances. When I add a band to a competition, I want to link back to the band details page (page link), but if the a band is from Ohio – they don’t have a details page (text).

    I’ve spent much time on Google and in forums here searching, and am either asking for too much – or searching for the wrong things.

    Any help?

  • You need to create a true/false field for something like

    “Band has Page”

    then you create a url field and a text field and each is conditional based on the selection of the true/false field.

    Then in your code

    
    if (get_field('my_true_false_field)) {
      // show url/page link field
    } else {
      // show text field
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.