Custom Fields


If you want to map custom content fields to your template's elements, you can extend the available field options with the functions below:

Text Field

Add a new field with a text value to the mapping dropdown. Every time an image gets generated, the closure below will be run and has to return a string value.

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

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";
});

Image Field

Add a new field with a text value to the mapping dropdown that contains an image URL. Every time an image gets generated, the closure below will be run and has to return the absolute URL to the image.

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

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 be publicly accessable URL of image
    return "https://URL-TO-POSTER.png";
});