Filter uncanny-automator-pro

uncanny_one_click_install_button_class

Filters the CSS classes applied to the one-click install button before it's displayed on the admin screen.

add_filter( 'uncanny_one_click_install_button_class', $callback, 10, 1 );

Description

Filter the CSS classes applied to the one-click plugin install button. Developers can modify the array of classes to customize the button's appearance. This hook fires just before the button HTML is generated.


Usage

add_filter( 'uncanny_one_click_install_button_class', 'your_function_name', 10, 1 );

Parameters

$plugin_info (mixed)
This parameter contains an array of CSS classes that will be applied to the one-click installation button.

Return Value

The filtered value.


Examples

<?php
/**
 * Add a custom class to the one-click install button when a specific plugin is being installed.
 *
 * @param array $button_classes The existing CSS classes for the button.
 * @param array $plugin_info Information about the plugin being installed.
 * @return array Modified CSS classes for the button.
 */
add_filter( 'uncanny_one_click_install_button_class', function( $button_classes, $plugin_info ) {
    // Check if the plugin slug matches a specific one we want to style differently.
    if ( isset( $plugin_info['slug'] ) && 'my-special-plugin' === $plugin_info['slug'] ) {
        // Add a custom class for our special plugin.
        $button_classes[] = 'my-special-plugin-install-button';
    }
    
    // You could also conditionally remove classes or add others based on other $plugin_info data.
    // For example, if you wanted to change the button color for premium plugins:
    // if ( isset( $plugin_info['is_premium'] ) && $plugin_info['is_premium'] ) {
    //     $button_classes[] = 'premium-plugin-button';
    // }

    return $button_classes;
}, 10, 2 ); // 10 is the priority, 2 is the number of arguments accepted by the callback.
?>

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

uncanny-automator-pro/src/core/admin/installer/class-plugin-installer.php:634

transform: rotate(360deg);
				}
			}
		</style>

		<div class="auto-plugin-install">
			<?php
				$button_class = apply_filters(
					'uncanny_one_click_install_button_class',
					array(
						'uoc-generate-button',
						'auto-plugin-install-button',
					),
					$plugin_info
				);

Scroll to Top