How make features simple and modular ?

Modularity exists entirely because of the human side of development. A computer doesn’t need a broken-down and embellished version of the code to be able to run it. It’s our own cognitive limitations that force us to write code in smaller pieces. A particular area where this becomes obvious is in dealing with visual scripting.

In Flopress, to keep it simple and modular, it’s better to split your feature in multiples actions and filters, which can be fired from each others.

Trigger another action with WordPress native mechanism.

In the example below, an action fires another action.

  • Create a new action with a custom name and define eventually arguments.
  • Add the component called “do_action” into your main flow.
  • Drop the new custom action into your main flow.
  • Connect the “name” output from the new action component to the “tag” input from “do_action”.
  • If needed, add an array with an arguments list and connect its output to the “arg” connector.
Fire a custom action from another action.

Run a flow script without using native mechanism.

Too many actions or filters can slow down the site. Alternatively, you can use the “fp_function” component to run the flow of a action/filter/shortcode, without using the native WordPress mechanism. It takes a “callable” value as first argument, and an array of parameters as second.

  • Create a new action with a custom name, define eventually arguments, and disable autoload.
  • Add the component called “fp_function” into your main flow
  • Drop the new action into your main flow.
  • Connect the “callable” output from the new action component to the “callable” input from “fp_function”.
  • Add an array, set arguments and connect its output to the “param_arr” connector.
Fire a action with the fp_function