Available Filters & Snippets

You can use the following snippets in your theme’s functions.php file or even better, create a custom plugin or using the Code Snippets plugin. (The latter two are the better options, as they won’t be overwritten by theme updates!)

You can find all picu filters and how they work below. Also have a look at the filter examples page for more advanced filtering.

picu Core

In the following section you find the filters/hooks that can be used with the free picu plugin you can download from WordPress.org. Below you will soon find more filters/hooks that can be used in conjunction with our Pro modules.

Define a custom base slug for collections

This will change the default slug from domain.tld/collections/ak4h38 to domain.tld/my-defined-slug/ak4h38.

Beware, that this changes the URL for all collections – including those you might have sent to clients before.

function my_picu_collection_slug() {
    return 'my-defined-slug';

add_filter( 'picu_collection_slug', 'my_picu_collection_slug' );

Please note: Make sure to go to “Settings > Permalinks” in your WordPress Admin after you implemented the snippet.

Disable random slug generation for picu collections

picu will then use the collection title to generate the slug, which is the WordPress default.

add_filter( 'picu_collection_do_random_slug', '__return_false' );

Set default share method to “Copy link & send manually”

picu will then select the Copy link & share manually tab by default, when you create a new collection.

add_filter( 'picu_default_share_method_is_email', '__return_false' );

Define a custom filename separator

This separator is used when you copy the image filenames after your client has approved a collection. The default is a single space.

The example below will add a comma after each filename.

function my_custom_filename_separator( $divider ) {
    return ', ';

add_filter( 'picu_filename_separator', 'my_custom_filename_separator' );

There is an alternate method of defining a custom filename separator available. Just put the following line in your wp-config.php file:

define( 'PICU_FILENAME_SEPARATOR', "\n" );

This will add a new line after each filename, btw.

Define custom filenames when copying approved image names

By default picu will not use a suffix (like .jpg), when you copy the image filenames after your client has approved a collection. With the following filter you can change what is being copied.

In the example below, we change the output to use the whole filenames, including the suffix (like .jpg).

function my_picu_approved_filename( $filename, $attachment_id ) {
    $attachment = wp_get_attachment_image_src( $attachment_id, 'full' );
    return wp_basename( $attachment[0] );

add_filter( 'picu_approved_filename', 'my_picu_approved_filename', 10, 2 );

By using the $attachement_id you can use pretty much any meta data attached to the respective image.

Define custom max width and height values for picu images

Set the maximum height and width with which picu images should be displayed.

function my_picu_large_image_size( $sizes ) {
    return array(
        'width' => 3000,
        'height' => 2000

add_filter( 'picu_large_image_size', 'my_picu_large_image_size' );

Do not generate picu’s custom image sizes

Disable the generation of custom smaller and intermediate image sizes

function my_picu_disable_custom_image_sizes( $sizes ) {
    return array();

add_filter( 'picu_intermediate_image_sizes', 'my_picu_disable_custom_image_sizes' );

Define a custom FROM name and address for picu emails

Change the default FROM name and address in emails that picu sends out. The default is no-reply@domain.tld.

function my_picu_email_from( $from ) {
    $from['name'] = 'Custom Name';
    $from['address'] = 'what.ever@you.choose.com';
    return $from;

add_filter( 'picu_email_from', 'my_picu_email_from' );

Please note, that using this filter will overwrite your settings under “picu > Settings > General Settings” (introduced in picu version 1.6.3).

Change the email subject of the email that is sent to the client for a new collection

By default, the subject contains the collection title. In the example below we add “Please approve:” in front of the collection title.

function my_picu_custom_collection_mail_subject( $collection_title ) {
    return 'Please approve: ' . $collection_title;

add_filter( 'picu_collection_mail_subject', 'my_picu_custom_collection_mail_subject' );

Define a custom message for picu emails

Change the default message in emails that picu sends out.

function my_picu_email_message( $message ) {
    $message = 'Custom Message';
    return $message;

add_filter( 'picu_client_mail_message', 'my_picu_email_message' );

Please note, that with our Brand & Customize Pro module, it is possible to create multiple email templates.

Define a custom TO address for approval email notifications

Please note: This filter will be available with picu 1.6.1.

By default approval notifications are sent to the email address of the user, who created the collection. With this filter you can overwrite that.

function my_picu_approval_mail_recipient( $post_id, $recipient_email ) {
	return 'what.ever@you.choose.com';

add_filter( 'picu_approval_mail_recipient', 'my_picu_approval_mail_recipient', 10, 2 );

Please note, that with the example above, all approval notifications will got to the same address.

Change the approval warning message

Change the content of the message that is displayed above the “Approve Selection” button. Defaults to:

You are about to approve this collection.
Please note, that you won’t be able to make changes to your selection after that.

function my_picu_approval_warning( $message ) {
    return '<p><strong>Thank you for your time.</strong><br />We will get right to work on your images!</p>';

add_filter( 'picu_approval_warning', 'my_picu_approval_warning' );

Add Custom JavaScript

Add custom scripts, eg. for tracking or analytics, to your picu collections.

function my_picu_custom_scripts( $custom_scripts ) {
    $custom_scripts .= '<!-- YOUR ANALYTICS JS CODE -->';

    return $custom_scripts;

add_filter( 'picu_custom_scripts', 'my_picu_custom_scripts' );

Warning: Make sure, to add your custom code to the $custom_scripts string. Do not just overwrite the variable.

Define who can use picu

Define a capability, which a user/role must have, to access picu. The default is manage_options.

function my_picu_custom_capability() {
    return 'edit_posts';

add_filter( 'picu_capability', 'my_picu_custom_capability' );

Brand & Customize Module

Use custom styles

Change the appearance of your collections by adding custom css.

function my_custom_picu_styles( $custom_styles ) {
    $custom_styles .= 'body { background-color: pink; }';
    return $custom_styles;

add_filter( 'picu_brand_customize_styles', 'my_custom_picu_styles' );

Warning: Make sure, to add your custom code to the $custom_styles string. Do not overwrite the variable!

Download Module

Define filename prefix in .zip file

By default picu adds numbers (with leading zeros) in front of the file name, when creating the .zip file. We do this to preserve the order in which the photos are displayed in the collection. You can change the prefix using this filter. To disable the prefix, just return an emptry string like so:

function my_picu_download_file_name_prefix( $prefix, $img_num, $images ) {
	return '';

add_filter( 'picu_download_file_name_prefix', 'my_picu_download_file_name_prefix', 10, 3 );

Delivery Module

Change the delivery box title

You can change the delivery box title by using the picu_delivery_box_title filter.

add_filter( 'picu_delivery_box_title', function( $title ) {
    return 'My custom delivery box title';

Change the delivery box message

You can use the delivery box message by using the picu_delivery_box_message filter.

add_filter( 'picu_delivery_box_message', function( $message ) {
    return 'My custom delivery box message';

Still having issues?

In your WordPress Admin go to picu > Settings > Debug Info and copy the contents of theis and your questions to support@picu.io.