1. Home
  2. Docs
  3. Flexi Gallery
  4. Developers
  5. Hook: flexi_add_icon_grid

Hook: flexi_add_icon_grid

This hook is used to add new buttons. These buttons are situated at gallery, popups & details layout.

Hook name: flexi_add_icon_grid
Hook type: filter
Parameter: array
Uses: <?php add_filter( 'flexi_add_icon_grid', 'flexi_function_name'); ?>
Sources: includes\functions.php (flexi_show_icon_grid function)

Example to add external link to http://yahoo.com:

function flexi_function_name($icon)
    {
        global $post;
        $link  = "http://yahoo.com";
        $extra_icon = array();

        $extra_icon = array(
            array(
                'trash', // icon name
                __('Yahoo', 'flexi'), //link title
                $link, //Link URL
                '#', //Link parameter argument
                $post->ID, //Current flexi post id
                'flexi_css_button', //link class name
                'id' // Link parameter name
            ),

        );

        // combine the two arrays
        if (is_array($extra_icon) && is_array($icon)) {
            $icon = array_merge($extra_icon, $icon);
        }

        return $icon;
    }
Generated html code: 
<a href="http://yahoo.com" class="flexi_css_button" id="#" data-nonce="923a43a3bc" data-post_id="317" title="Yahoo">
    <span class="flexi_css_button-border">
       <span class="flexi_icon_link"></span>
    </span>
</a>
Generated link button

Leave a Reply