• Resolved ashf

    (@ashf)


    Is there a filter hook for tile content in order to modify them?

    i.e.
    I would like to add something complex programmatically that’s not possible though GUI.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Code Amp

    (@codeamp)

    Hey @ashf,

    We have a few hooks (we’re still building the website/docs) but maybe not for what you want to do exactly.

    Can you explain a couple of things for me, and perhaps I can guide you (or add some hooks for you):

    1) Where do you want to modify content?
    2) What functionality are you trying to add to the tile?

    FYI, today/tomorrow, we’re adding support for basic custom fields and taxonomies.

    Thanks
    – Ross

    Hi there,

    I second this request, as a S&F pro user, I wish I could customise cards more extensively.

    This applie to card content, card class, and grid class.

    Thread Starter ashf

    (@ashf)

    Hi Ross,

    i.e.
    – Modifying basic elements such as Title or Excerpt for custom html structure.
    – Inserting a custom element between(before/after) basic elements.

    Reason I need “Custom element” is that I often use php function to create an element that requires (complex) conditional logic on other page/layout builder.
    Like conditions depend on page language, custom field value and so on.

    https://ps.w.org/custom-layouts/assets/screenshot-2.png

    Plugin Author Code Amp

    (@codeamp)

    Hi both, so this is what we have currently in our code:

    Layouts
    Actions:
    do_action( "custom-layouts\layout\before_render", $settings, $this->name );
    do_action( "custom-layouts\layout\after_render", $settings, $this->name );

    Filters
    $settings = apply_filters( 'custom-layouts\layout\render_args', $settings, $this->name );
    $output = apply_filters( "custom-layouts\layout\render_output", $output, $this->name, $settings );

    Templates

    Filters:
    $settings = apply_filters( 'custom-layouts\template\render_args', $settings, $this->name );
    $output = apply_filters( "custom-layouts\template\render_output", $output, $this->name, $settings );

    Actions
    do_action( "custom-layouts\template\before_render", $settings, $this->name );
    do_action( "custom-layouts\template\after_render", $settings, $this->name );

    —-

    I think the actions speak for themselves… For the filters, for layouts and templates you have 2:

    render_args

    Here you can update $settings argument used to generate the render

    render_output

    This contains the full html of what will be printed to screen, so you can manipulate this where necessary.

    I think after reading both your comments, it would also be good to add the same actions/filters for individual elements?

    – So we have a before/after render element action
    – And we can update the args / output of each using a filters

    What do you think?

    (I am in the process of writing all this up on a new site we are building)

    • This reply was modified 3 years, 8 months ago by Code Amp.
    • This reply was modified 3 years, 8 months ago by Code Amp.
    Plugin Author Code Amp

    (@codeamp)

    @jbonlinea

    For both Layouts and Templates, you can add custom classes via the admin UI by looking in the Advanced panel.

    If you want to add a class to the layout or template via code, you can use the render_args filter.

    Plugin Author Code Amp

    (@codeamp)

    I’ve been doing some testing with these hooks, and it seems some of them were not working.

    We’ve held back our update, and will do a combined release with a bunch of new features, fixes for these hooks, and new hooks for elements too.

    Look out for the next update in the next few days.

    Thanks

    • This reply was modified 3 years, 8 months ago by Code Amp.
    Plugin Author Code Amp

    (@codeamp)

    Hey all – just to let you know we’ve put the docs up for these (and fixed a few issues surrounding our hooks in 1.4.0):

    https://customlayouts.com/documentation/action-filter-reference/

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Filter hook for tile content?’ is closed to new replies.