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. (More on the latter soon.)

You can find all the filters on Bitbucket as well.


Define a custom slug for collections

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

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

add_filter( 'picu_collection_slug', 'my_picu_collection_slug' );

Disable random slug generation for picu collections

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

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

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

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.

Still having issues?

In your WordPress Admin go to picu > Settings > Debug Info and send the contents to support@picu.io.