FooGallery Hooks

FooGallery Documentation

FooGallery Hooks

foogallery_admin_print_styles
Description: This allows you to enqueue custom CSS styles to the FooGallery admin area, enabling you to style the admin interface according to your requirements.
Use Case Example:

add_action('foogallery_admin_print_styles', function() {
wp_enqueue_style('custom-admin-style', get_stylesheet_directory_uri() . '/css/custom-admin-style.css');
});

foogallery_admin_print_scripts
Description: This allows you to enqueue custom JavaScript scripts to the FooGallery admin area, facilitating the addition of custom functionality or interactivity.
Use Case Example:

add_action('foogallery_admin_print_scripts', function() {
wp_enqueue_script('custom-admin-script', get_stylesheet_directory_uri() . '/js/custom-admin-script.js', array('jquery'), null, true);
});

foogallery_after_save_gallery
Description: This triggers custom actions immediately after a gallery is saved, enabling you to perform operations such as logging or additional processing.
Use Case Example:

add_action('foogallery_after_save_gallery', function($gallery_id) {
error_log('Gallery ' . $gallery_id . ' was saved.');
});

foogallery_loaded_template_after
Description: This allows you to execute custom code after a gallery template has been loaded, which can be used for further customization or initialization.
Use Case Example:

add_action('foogallery_loaded_template_after', function($template, $gallery) {
// Custom code to run after the template is loaded
});

foogallery_admin_menu_after
Description: This enables you to add custom submenu items to the FooGallery admin menu for extending the admin interface with additional pages.
Use Case Example:

add_action('foogallery_admin_menu_after', function() {
add_submenu_page('foogallery', 'Custom Menu', 'Custom Menu', 'manage_options', 'custom-menu', 'custom_menu_page_callback');
});

wp_ajax_foogallery_gallery_export
Description: This AJAX hook handles the export of gallery data, allowing you to customize or extend the export functionality.
Use Case Example:

add_action('wp_ajax_foogallery_gallery_export', function() {
// Custom code to handle the gallery export
wp_send_json_success(array('message' => 'Gallery exported successfully.'));
});

foogallery_attachment_modal_tabs_view
Description: This allows you to add custom tabs to the attachment modal, providing additional options or settings within the modal interface.
Use Case Example:

add_filter('foogallery_attachment_modal_tabs_view', function($tabs) {
$tabs['custom-tab'] = 'Custom Tab';
return $tabs;
});

foogallery_located_template
Description: This enables you to execute custom code when a gallery template is located, useful for modifying or extending template functionality.
Use Case Example:

add_action('foogallery_located_template', function($template) {
// Custom code to run when the template is located
});

foogallery_admin_settings_custom_type_render_setting
Description: This allows you to add custom settings fields to the FooGallery admin settings page, enabling the extension of configuration options.
Use Case Example:

add_action('foogallery_admin_settings_custom_type_render_setting', function() {
    // Custom settings HTML
    echo '<input type="text" name="custom_setting" value="" />';
});
Code language: PHP (php)

add_meta_boxes_foogallery
Description: This enables you to add custom meta boxes to the FooGallery post type, providing additional fields or options within the gallery edit screen.
Use Case Example:

add_action('add_meta_boxes_foogallery', function() {
add_meta_box('custom_metabox', 'Custom Metabox', 'custom_metabox_callback', FOOGALLERY_CPT_GALLERY, 'side', 'default');
});

foogallery_admin_settings_override
Description: This allows you to override default FooGallery admin settings, enabling the customization of configuration options.
Use Case Example:

add_filter('foogallery_admin_settings_override', function($settings) {
// Modify settings
$settings['custom_setting'] = 'value';
return $settings;
});

foogallery_attachment_instance_after_load
Description: This is triggered after an attachment instance is loaded, allowing you to determine or modify the attachment type.
Use Case Example:

add_action('foogallery_attachment_instance_after_load', function($attachment) {
// Custom code to determine attachment type
});

foogallery_gallery_metabox_items_add
Description: This allows you to add custom items to the gallery metabox, extending the options or information displayed within the metabox.
Use Case Example:

add_action('foogallery_gallery_metabox_items_add', function() {
// Add custom items to the metabox
});

foogallery_woocommerce_product_data_panels
Description: This allows you to add custom fields or panels to WooCommerce product data, integrating FooGallery functionality within WooCommerce products.
Use Case Example:

add_action('foogallery_woocommerce_product_data_panels', function() {
// Custom fields HTML for WooCommerce products
});

foogallery_datasource_modal_content_post_query
Description: This allows you to add custom content to the data source modal for post queries, providing additional options or information.
Use Case Example:

add_action('foogallery_datasource_modal_content_post_query', function() {
// Custom content for post query data source modal
});

foogallery_load_template
Description: This triggers custom actions when templates are loaded, allowing you to modify or extend template functionality.
Use Case Example:

add_action('foogallery_load_template', function($template) {
// Custom code to run when templates are loaded
});

foogallery_datasource_modal_content_folders
Description: This allows you to add custom content to the data source modal for folders, providing additional options or information.
Use Case Example:

add_action('foogallery_datasource_modal_content_folders', function() {
// Custom content for folders data source modal
});

foogallery_located_album_template_stack
Description: This allows you to execute custom code for stack album templates, useful for extending or modifying album template functionality.
Use Case Example:

add_action('foogallery_located_album_template_stack', function($template) {
// Custom code for stack album templates
});

wp_ajax_foogallery_save_gallery
Description: This AJAX hook handles the saving of gallery data, enabling you to customize or extend the save functionality.
Use Case Example:

add_action('wp_ajax_foogallery_save_gallery', function() {
// Custom code to handle gallery save
wp_send_json_success(array('message' => 'Gallery saved successfully.'));
});

foogallery_render_gallery_template_field_custom
Description: This allows you to add custom fields to the gallery template settings, providing additional configuration options.
Use Case Example:

add_action('foogallery_render_gallery_template_field_custom', function($field) {
    // Custom fields HTML
    echo '<input type="text" name="custom_field" value="" />';
});
Code language: PHP (php)

foogallery_loaded_template_before
Description: This enables you to execute custom code before a gallery template is loaded, allowing for pre-processing or initialization.
Use Case Example:

add_action('foogallery_loaded_template_before', function($template, $gallery) {
// Custom code to run before the template is loaded
});

foogallery_attachments_list_bar_buttons
Description: This allows you to add custom buttons to the attachments list bar, providing additional actions or options.
Use Case Example:

add_filter('foogallery_attachments_list_bar_buttons', function($buttons) {
    $buttons[] = '<button class="button">Custom Button</button>';
    return $buttons;
});
Code language: PHP (php)

foogallery_datasource_media_library_attachments
Description: This allows you to customize the retrieval of attachments from the media library, enabling the modification or filtering of media items.
Use Case Example:

add_filter('foogallery_datasource_media_library_attachments', function($attachments) {
// Modify or add attachments
return $attachments;
});

foogallery_gallery_shortcode_output
Description: This allows you to modify the output of the gallery shortcode, enabling customization of the gallery display.
Use Case Example:

add_filter('foogallery_gallery_shortcode_output', function($output, $gallery) {
    // Modify the shortcode output
    return $output . '<p>Custom content after gallery</p>';
}, 10, 2);
Code language: PHP (php)

foogallery_attachment_image_attributes
Description: This allows you to customize the attributes of images within the gallery, such as adding custom classes or data attributes.
Use Case Example:

add_filter('foogallery_attachment_image_attributes', function($attributes, $attachment, $size) {
$attributes['class'] .= ' custom-class';
return $attributes;
}, 10, 3);

foogallery_gallery_data
Description: This allows you to filter the data used to generate the gallery, enabling you to modify or extend the gallery content.
Use Case Example:

add_filter('foogallery_gallery_data', function($data, $gallery_id) {
// Modify gallery data
$data['custom_key'] = 'custom_value';
return $data;
}, 10, 2);

foogallery_template_variables
Description: This allows you to filter the variables passed to gallery templates, enabling you to add or modify the data available in templates.
Use Case Example:

add_filter('foogallery_template_variables', function($variables, $template, $gallery) {
$variables['custom_variable'] = 'custom_value';
return $variables;
}, 10, 3);