Support

Account

Forum Replies Created

  • I think you could do this with some custom JavaScript loaded on the admin page via admin_enqueue_scripts.

    Say your field is named “my_field”, you could try something like this (using jQuery):

    
    if ( $("#acf-field-my_field").val() ) {
     $("#acf-my_field .label").append("My new text here");
    }
    

    Haven’t tested it but that’s where I’d start.

  • I suspect the issue is with the logic you’re using in the template itself. Let’s say the field is called “enable_sidebar” and the options are “enable” & “disable”. Existing posts will not have any value stored for the field “enable_sidebar” until you re-save them, so you need to count the scenario of having no value as equivalent to “enable”.

    Something like this should do it:

    
    if (!get_field("enable_sidebar") || get_field("enable_sidebar") == "enable") {
    
    //sidebar here
    
    }
    
  • Nice find! This does appear to work. So my next question is: Would it still be nice to have this as an option in the UI? I suspect that in many (if not most) cases drafts are unwanted. For me the filters are sufficient, just trying to think of the less technically-inclined.

Viewing 3 posts - 1 through 3 (of 3 total)