Logo
Logo

Custom PHP Conditions

Using Custom PHP Conditions in Breakdance

This tutorial demonstrates how to use a custom PHP condition to hide content in Breakdance. This video shows how this can be done using WooCommerce functions to conditionally show or hide content.

Setting the PHP Condition

  1. Go to Settings > Conditions > Edit Conditions. This will open up the Conditions Popup.
  2. Click “+Add Condition”.
  3. Select the “Choose Condition” dropdown and select the “Custom PHP” condition.
  4. Click the “Open PHP Editor” button.
  5. Add the PHP for the condition.
  6. Close the PHP Editor
  7. Click the “Apply Conditions” button.

When writing custom PHP, you will generally want the code or function to return true for when you want content to show, and false for when you want it to be hidden.

While the Breakdance Support team cannot help create custom conditions, here are some condition examples that may be useful:

Finalizing and Testing Conditions

After applying the condition, visit the page on the front end to see the conditions in action and verify that they are working correctly.

Additional Notes

This approach highlights the flexibility and power of Breakdance with custom PHP conditions, allowing for the creation of distinct layouts based on these conditions and enhancing both the user experience and the visual appeal of a site.