お使いの環境を選んでください。コードをコピペするだけで動作します。
__SB_API_KEY__
をお手元のAPI keyに置き換えてご利用ください。
紛失している場合は 連携をやり直す 必要があります。
// functions.php
function social_bridge_enqueue() {
wp_enqueue_script(
'social-bridge',
'https://cdn.social.quon.io/v1/embed.js',
array(),
'1.0',
true
);
}
add_action('wp_enqueue_scripts', 'social_bridge_enqueue');
[social_bridge api_key="__SB_API_KEY__" columns="4" limit="8"]
---
import "social-bridge/style.css";
---
<head>
<script src="https://cdn.social.quon.io/v1/embed.js" defer></script>
</head>
<social-bridge
api-key="__SB_API_KEY__"
columns="4"
limit="8">
</social-bridge>
import Script from "next/script";
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<Script src="https://cdn.social.quon.io/v1/embed.js" strategy="afterInteractive" />
</body>
</html>
);
}
export default function Feed() {
return (
<social-bridge
api-key="__SB_API_KEY__"
columns={4}
limit={8}
/>
);
}
<!-- Social Bridge -->
<script src="https://cdn.social.quon.io/v1/embed.js" defer></script>
<social-bridge
api-key="__SB_API_KEY__"
columns="4"
limit="8">
</social-bridge>
うまく動かないときは、以下もご確認ください。
以下を順にご確認ください:
1. API keyが正しいか (前後のスペースに注意)
2. スクリプトのURLが cdn.social.quon.io/v1/embed.js になっているか
3. 連携から1時間以内の場合は、最初のcron実行を待っています
CSS変数 --sb-gap / --sb-radius / --sb-bg で外観の上書きが可能です。詳細はAPIリファレンスをご参照ください。
limit 属性で1〜20の範囲で指定できます。1ページあたりの読み込み量を考慮し、初期値は8です。