Home Forums ACF PRO Hook into field loop and output content via plugin (Flexible Content Field)


Hook into field loop and output content via plugin (Flexible Content Field)

  • In reference to the flexiable content field:

    What I need to happen is basically output the HTML/content of a layout using a plugin within a custom template of the active theme.

    So the code below will be in a custom template file in the active theme.
    Looking at this simple example loop:

         // loop through the rows of data
        while ( have_rows('flexible_content_field_name') ) : the_row();
    //is there a some hook i can attach to in here that the plugin can get invoked based on either the_row, get_row_layout etc or anything else where i can get in this loop match the layout name and output the relevant html ?

    I am trying to avoid using shortcodes with do_shortcode() based on the layout name/plugin name match, so if there is another way that would be great.


  • There are no filters/actions or hooks that fire here.

    You would need to

    1. use a shortcode as you describe
    2. Call a function
    3. Create your own action/filter hook

    Edit: What you are asking for would be the equivalent of a WP hook that you could use here

    while(have_posts()) {
      // there is not WP hook that fires here
  • John,

    Thanks for the reply. I think a action/filter hook inside the loop might not be a bad idea. I tested the process out and it worked great.

    You can close this query.


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

You must be logged in to reply to this topic.