PHP code example of moderntribe / tribe-alerts

1. Go to this page and download the library: Download moderntribe/tribe-alerts library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

moderntribe / tribe-alerts example snippets



 if ( function_exists( '\Tribe\Alert\tribe_alert' ) && function_exists( '\Tribe\Alert\render_alert' ) ) {
    \Tribe\Alert\render_alert();
} 

define( 'TRIBE_ALERTS_AUTOMATIC_OUTPUT', false );

add_filter( 'tribe/alerts/view_directory', static fn ( string $directory ) => get_stylesheet_directory() . '/components/alerts', 10, 1 );

define( 'TRIBE_ALERTS_COLOR_OPTIONS', true );

add_filter( 'tribe/alerts/color_options', static fn ( array $options ) => [
    '#880ED4' => [
        'name'  => esc_html__( 'Purple', 'tribe-alerts' ),
        'class' => 'purple-mono',
    ],
    '#8155BA' => [
        'name'  => esc_html__( 'Violet', 'tribe-alerts' ),
        'class' => 'violet',
    ],
    '#323E42' => [
        'name'  => esc_html__( 'Charcoal', 'tribe-alerts' ),
        'class' => 'charcoal',
    ],          
], 10, 1 );

add_filter( 'tribe/alerts/color_options/css_class_prefix', static fn ( string $prefix ) => 'new-prefix', 10, 1 );