Actions & Filters

When using filter and actionss, use a filter priority above 10. To apply filters before our premium plugins, use a filter below 15. To apply a filter after our premium plugins, use It’s safest to use our functions add_filter_once and add_action_once, otherwise, when more than one grid is displayed, filters may be added more than once, causing a slowdown and flickering.

Examples

add_action_once ( featured_image_pro_masonry_register_scripts’, ‘myaction, 16 );

function myaction()
{
     dosomething();
}

add_filter_once ('proto_grid_container_class', ‘myfunction’, 16, 2);

function myfunction($class, $options)
{
     $class = $class . $options[‘somesetting’];
}

Actions

Register Scripts

do_action(‘featured_image_pro_masonry_register_scripts’);

Initialize before the grid is created

do_action(‘proto_image_pro_init’, 
    $options //array of widget options
);

Execute an action after the query

do_action(‘proto_masonry_after_query’, 
    $query, //query results
    $attributes //the query attributes
);

Filters

Add a class to the grid container element

apply_filters('proto_grid_container_class', 
    $gridclass, //current grid class
    $options //array of widget options
);

returns modified grid class

Extract options from the arguments sent to the widget

Use this to add your own options

apply_filters('proto_masonry_options',  
    $options,  //current array of options
    $args //arguments sent to the widget
);

returns modified options

Insert additional styles into the inline styles

apply_filters('proto_inline_css’, 
    $styles, //current inline styles 
    $options //array of widget options
);

returns inline styles

Append additional scripts to the footer script.

You must encapsulate your scripts with script tags

$script = "";

apply_filters('proto_masonry_footer_scripts', 
    $script, //current footer scripts
    $options //array of widget options
);

returns footer scripts

Add a style to the inline styles for the excerpts

apply_filters('proto_masonry_excerptstyles', 
    $excerptstyle, //current inline styles for the excerpts
    $options //array of widget options
);

returns inline styles for excerpts

Add a style to the inline styles for the figcaption element

apply_filters('proto_masonry_captionstyles', 
    $captionstyle, //current inline styles for the figcaption element
    $options //array of widget options
);

returns styles for the figcaption element

Add a style to the inline styles for the grid items

apply_filters('proto_masonry_itemstyles', 
    $itemstyle, //current inline styles for the grid items
    $options //array of widget options
);

returns styles for the grid items

Add a style to the inline styles for the grid

apply_filters('proto_masonry_gridstyles', 
    $gridstyle, //current inline styles for the grid
    $options //array of widget options
);

returns styles for the grid

Add a style to the inline styles for the images

apply_filters('proto_masonry_imagestyles', 
    $imagestyle, //current inline styles for the grid items
    $options //array of widget options
);

returns styles for the images

Insert options into the masonry script

apply_filters('proto_masonry_script_options', 
    $script, //masonry script
    $options //array of widget options
);

returns masonry script

Apply Filters to the title for specific posts

apply_filters('proto_image_pro_post_title', 
    $title, //post caption/title
    $options, //array of  widget options
    $postid //post identifier
);

return title/caption

Append to the title/caption

apply_filters(‘proto_image_after_caption', 
    $extra, //elements & text to be appended after the caption
    $options, //array of widget options
    $postid //the post ID
);

returns content to be displayed after the title/caption

Add/remove/change properties to an image object

apply_filters('proto_snap_image_object', 
    $img, //image object
    $options, //array of widget options
    $postid //the post ID
);

returns image object

Add/remove/change properties to an attachment object

apply_filters('proto_masonry_attachments', 
    $attobject, //attachment option
    $options, //array of widget options
    $_query //WordPress query object
);

return attachment object

Modify the fields in a query

apply_filters('proto_image_pro_post_posts_fields', 
    $pfields //The post-fields part of the query
);

Modify the join section of a query

apply_filters('proto_image_pro_post_posts_join', 
    $pjoin //The post-join part of the query
);

Modify the where section of a query

apply_filters('proto_image_pro_post_posts_where', 
    $pwhere //The post-where part of the query
);

Modify the orderby section of a query

apply_filters('proto_image_pro_post_posts_orderby', 
    $oby //The orderby section of the query
);