Embedding a Snippet in WordPress
Quick Guide for the Gutenberg Editor
- Click Embed Button:
- Below each snippet is an Embed button. Click it to view the embed code.
- Copy the HTML Code:
- Start by copying the embed code provided. It should look something like this:
<iframe src="https://shnippet.com/embed/1419/?lang=php" id="shnippet1419-php" max-width="900px" min-width="100%" width="100%" frameborder="0"></iframe><script src="https://shnippet.com/iframe.js" onload="iFrameResize('','#shnippet1419-php')"></script>
- Start by copying the embed code provided. It should look something like this:
- Log in to Your WordPress Site:
- Ensure you are logged into the WordPress admin dashboard of your website.
- Open the Post or Page in Gutenberg:
- Navigate to the page or post where you want to embed the snippet, or create a new post/page by clicking on Add New.
- Add a Custom HTML Block:
- In the Gutenberg editor, click the + button to add a new block.
- Search for Custom HTML and select it.
- Paste the HTML Code:
- In the Custom HTML block, paste the embed code you copied earlier.
- Preview the Embed:
- You can click the Preview button at the top of the editor to see how the snippet will appear on your site. Alternatively, in the block toolbar, switch to the Preview option to view it without leaving the editor.
- Publish or Update: Once you’re satisfied with the placement, either click Publish or Update to save your changes.
That’s it! Your snippet is now embedded on your WordPress page or post using the Gutenberg editor.