• Resolved cosm44

    (@cosm44)


    Is there any way to write custom PHP conditions? I’m a code/PHP hack, so a simple example would be good if you have anything. Something like:

    <?php
    if ( my_custom_function === true ) {
       return false; // Block is Hidden
    }
    ?>

    A different plugin, Wicked Block Conditions has a feature to “Show or hide blocks based on the result of a PHP function.” I may end up using it, but wanted to check and see if you had something similar.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Nick Diego

    (@ndiego)

    Hi @cosm44,

    No, Block Visibility does not support PHP conditions. Let me know if I can answer any additional questions.

    Best,
    Nick

    Thread Starter cosm44

    (@cosm44)

    Any plans to support PHP conditions in the future?

    Or perhaps you could help me figure out another way to do what I need…

    I have a group block with a heading and query loop block inside. On certain pages, the query loop block returns 0 posts — I’d like to hide the entire group if that’s the case.

    If that’s beyond the scope of the plugin, no big deal – thanks for the quick reply!

    Plugin Author Nick Diego

    (@ndiego)

    Not currently, and there is no way to really accomplish what you are looking for with Block Visibility. That said, Conditional Blocks and/or Wicked Block Conditions do support PHP functionality and might be worth a try.

    Best,
    Nick

    Thread Starter cosm44

    (@cosm44)

    Okay, thanks. Just wanted to check. ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom PHP Conditions?’ is closed to new replies.