Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I have 15 images in a post, how can I add the custom field for all images?

    I don’t know why it doesn’t work for me. I used generatepress theme. I add the following code on my theme function.php file

    add_filter( ‘scriptlesssocialsharing_pinterest_image_attributes’, ‘rgc_sample_pin_id’ );
    /**
    * Add data-pin-id to the hidden Pinterest image attributes, if the
    * custom field has been manually added.
    *
    * @param array $attributes
    * @return array
    */
    function rgc_sample_pin_id( $attributes ) {
    $pin_id = get_post_meta( get_the_ID(), ‘scriptless_pinterest_pinid’, true );
    if ( $pin_id ) {
    $attributes[‘data-pin-id’] = $pin_id;
    }

    return $attributes;
    }

    is there anything else I have to do?
    Thanks for your time.

Viewing 2 replies - 1 through 2 (of 2 total)