We are in the process of updating our documentation. We know, a lot is still missing. Thank you for your patience.

Available Filters & Snippets

You can use the following snippets in your theme’s functions.php file or even better, create a custom plugin. (The later is the better option, please check it out!)

You can find all the filters on Bitbucket as well.


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' );

Define a custom filename separator

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

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 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' );

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' );

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!

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.