ID, true); if (!$pin_count) { // Start a new record for this $post_id update_post_meta($pin_image, 'apx_pin_count', 1); update_post_meta($pin_image, 'apx_traffic_post_id_' . $post_id->ID, 1); } else { // Increment the record by one. update_post_meta($pin_image, 'apx_pin_count', $pin_count + 1); update_post_meta($pin_image, 'apx_traffic_post_id_' . $post_id->ID, (int) $post_count + 1); } } function frontend_scripts() { $pin_sdk = 'https://assets.pinterest.com/sdk/sdk.js'; $js_path = plugins_url('/advanced-pins/dist/main.js'); $dependencies = [ 'apx-pin-sdk', 'jquery' ]; wp_enqueue_script('apx-pin-sdk', $pin_sdk, [], false, true); wp_enqueue_script('apx-frontend', $js_path, $dependencies, false, false); }