Custom Layer Values


You can extend the default layer mapping options of our WordPress plugin with custom values.

Custom Text Layer Value

Add a custom dropdown value for text layers by using the placid_add_text_field function.

/images/docs/wordpress-text-field.png

The closure below will be run every time an image is being generated and has to return a string value.

placid_add_text_field('movie-title', "Movie Title", function ($params) {

    $params['object_type']; // - post, tag, category  
    $params['object_id']; // - null || id 
    $params['post_type']; // - null || custom_post type = 'movies'
    $params['image']; // - ogimage/twitter/pinterest

    // - must return string
    return "MOVIE TITLE";
});

Custom Image Layer Value

Add a custom dropdown value for image layers by using the placid_add_image_field function.

/images/docs/wordpress-text-field.png

The closure below will be run every time an image is being generated and has to return a string value.

placid_add_image_field('movie-poster', "Movie Poster", function ($params) {

    $params['object_type']; // - post, tag, category  
    $params['object_id']; // - null || id 
    $params['post_type']; // - null || custom_post type = 'movies'
    $params['image']; // - ogimage/twitter/pinterest

    // - must return string with publicly accessible URL of an image
    return "https://URL-TO-POSTER.png";
});