Viewing 4 reply threads
  • Author
    Posts
    • #816

      It’s always best to have one widget rather than multiple that essentially do the same thing. I’m using some simple if/else statements for the widget output but it would be really handy for the user to set these options before-hand, a simple example would be:

      1. insert image dropdown yes/no
      2. if “yes” use can enter an image url
      3. if “no” theres someway to remove the image tag from the output

      I guess similar to your “add_more” field, but with a disable/enable option.

    • #817
      Steve
      Keymaster

      @badlydrawnrob–  The difference between Piklist and other “similiar” systems is that Piklist just makes WordPress easier… but it’s still WordPress.  Just use standard conditionals to show/hide fields.

      1. insert image dropdown yes/no: This is a Piklist SELECT field.
      2. if “yes” use can enter an image url
      3. if “no” theres someway to remove the image tag from the output

      For steps 2 and 3 use the standard WP function, get_option(), to get the value of step 1. Then wrap the output in the conditional. If true: show the output.

      Does this make sense?

    • #822

      @sbruner Ok, so that did make sense although I had to do a lot of digging, and a lot of trial and error … here’s my experience so far:

      Conditional meta fields doesn’t work for widgets unless I’m mistaken: WordPress doesn’t load any widget areas in admin when using this setup with this widget (I’m pretty sure the code on the widget is wrong, but it won’t have affected the whiteout issue (the issue is always resolved by removing the select dropdowns)

      I finally managed to make the conditional statements work (I tried a few different ways as the get_options() docs are pretty sparse. However, for the life of me I can’t figure out why all the if/elseif statements won’t be working with wp_list_pages(). You can check out my code here, along with the failed attempt.

      Again, I’m a beginner in PHP so I might be missing something, though I can’t think what. Would appreciate any feedback you can give.

    • #824

      So after talking to a php friend the if/else issue with wp_list_pages() is due to me not understanding the specificity of conditionals properly. Still no further with that one but at least I know it’s my fault!

      It’d be helpful to get feedback on the user-admin side of things though, and if the conditional fields is currently only for settings pages, if it should work on the widget admin, or if I’m just doing something wrong.

    • #826
      Steve
      Keymaster

      Can you give us a specific example of what you want to achieve?

Viewing 4 reply threads
  • You must be logged in to reply to this topic.