1. Home
  2. Docs
  3. 3D
  4. Frontend
  5. PHP Hooks & Filters

PHP Hooks & Filters

PHP Actions

wp3dconf/frontend/after_enqueue

Fires after all frontend scripts and styles have been enqueued.

add_action( 'wp3dconf/frontend/after_enqueue', function() {
  wp_enqueue_script( 'my-frontend-addon', plugin_dir_url( __FILE__ ) . 'frontend-addon.js' );
} );

wp3dconf/frontend/before_skin_display

Fires before the configurator skin is rendered.

ParameterTypeDescription
$skin_instanceObjectThe skin class instance
$post_idintThe configurator post ID

wp3dconf/frontend/after_skin_display

Fires after the configurator skin has been rendered.

ParameterTypeDescription
$skin_instanceObjectThe skin class instance
$post_idintThe configurator post ID

wp3dconf/frontend/form/hidden_fields

Fires inside the configurator form after the default hidden fields. Use this to output additional hidden inputs.

ParameterTypeDescription
$skinObjectThe current skin instance

The $skin object exposes a $skin->store property – an Alpine.js store reference string (e.g. $store.wp3dconf_123). Use this to bind hidden fields to live store values via x-bind:value.

add_action( 'wp3dconf/frontend/form/hidden_fields', function( $skin ) {
  // Static value
  echo '<input type="hidden" name="my_field" value="my_value">';

  // Bind to Alpine.js store - value updates reactively as the customer configures
  echo '<input type="hidden" name="active_layers"
    x-bind:value=\'JSON.stringify(' . esc_attr( $skin->store ) . '.activeLayers)\'>';

  // Bind attachment ID
  echo '<input type="hidden" name="attachment_id"
    x-bind:value=\'' . esc_attr( $skin->store ) . '.attachmentID\'>';

  // Bind all custom layer data (text, range, etc.)
  echo '<input type="hidden" name="custom_data"
    x-bind:value=\'JSON.stringify(' . esc_attr( $skin->store ) . '.customData)\'>';
}, 10, 1 );

Controls Rendering Actions

These actions fire around the rendering of each control element in the frontend HTML output.

HookParametersDescription
wp3dconf/frontend/controls/before_html$skinBefore the entire controls wrapper
wp3dconf/frontend/controls/after_html$skinAfter the entire controls wrapper
wp3dconf/frontend/controls/before_inner_html$skinBefore the inner controls container
wp3dconf/frontend/controls/after_inner_html$skinAfter the inner controls container
wp3dconf/frontend/controls/before_group_html$skinBefore a group block is rendered
wp3dconf/frontend/controls/after_group_html$skinAfter a group block is rendered
wp3dconf/frontend/controls/before_control_item$layer, $skinBefore a control item wrapper
wp3dconf/frontend/controls/before_control_item_inner$layer, $skinBefore a control item inner container
wp3dconf/frontend/controls/after_control_item_inner$layer, $skinAfter a control item inner container
wp3dconf/frontend/controls/before_control_icon$uid, $skinBefore the control icon element
wp3dconf/frontend/controls/after_control_icon$uid, $skinAfter the control icon element
wp3dconf/frontend/controls/layer_{type}_html$layer, $skinInside a control item for a specific layer type. Replace {type} with the layer type slug (e.g. layer_color_html).
// Add content after a control icon
add_action( 'wp3dconf/frontend/controls/after_control_icon', function( $uid, $skin ) {
  echo '<span class="my-badge">New</span>';
}, 10, 2 );

// Custom HTML for a specific layer type
add_action( 'wp3dconf/frontend/controls/layer_color_html', function( $layer, $skin ) {
  echo '<span class="color-swatch" style="background:' . esc_attr( $layer['value'] ) . '"></span>';
}, 10, 2 );

Skins

wp3dconf/register_skins

Fires on plugins_loaded (priority 20). Use this hook to register a custom skin class via Skin_Registry::register().

ParameterTypeDescription
$skin_nameStringUnique skin identifier
$skinString|ObjectFully-qualified class name string or an object instance
use WP3DCONF\Skin_Registry;

add_action( 'wp3dconf/register_skins', function() {
  Skin_Registry::register( 'my-skin', My_Custom_Skin::class );
} );

You can also pass an object instance. The skin system will clone it and call set_post_id() automatically.

use WP3DCONF\Skin_Registry;

add_action( 'wp3dconf/register_skins', function() {
  Skin_Registry::register( 'my-skin', new My_Custom_Skin() );
} );

Your skin class must extend WP3DCONF\Skin_Base and implement the display() method.

namespace My_Addon;

use WP3DCONF\Skin_Base;
use WP3DCONF\Skin_Registry;

class My_Custom_Skin extends Skin_Base {

  protected $skin_id = 'my-skin';

  public function display( $output = true ) {
    // Render your skin HTML
  }
}

wp3dconf/registered_skins

Filters the full array of registered skins after wp3dconf/register_skins has fired. Use this to modify or remove existing skin registrations.

ParameterTypeDescription
$skinsArrayAll registered skins keyed by skin identifier
add_filter( 'wp3dconf/registered_skins', function( $skins ) {
  unset( $skins['accordion'] );
  return $skins;
} );

How can we help?